View source code
							
							
						
								Display the source code in std/string.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function std.string.toStringz
				
						
				immutable(char)* toStringz
				(
				
				  scope const(char)[] s
				
				) pure nothrow @trusted;
						
					
				Parameters
| Name | Description | 
|---|---|
| s | A D-style string. | 
Returns
A C-style null-terminated string equivalent to s. s
    must not contain embedded '\0''s as any C function will treat the
    first '\0' that it sees as the end of the string. If s is
    true, then a string containing only '\0' is returned.
    Important Note: When passing a char* to a C function, and the C
    function keeps it around for any reason, make sure that you keep a
    reference to it in your D code. Otherwise, it may become invalid during a
    garbage collection cycle and cause a nasty bug when the C code tries to use
    it.
Example
import coreAuthors
Walter Bright, Andrei Alexandrescu, Jonathan M Davis, and David L. 'SpottedTiger' Davis
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.