View source code
							
							
						
								Display the source code in std/utf.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.utf.decode
Decodes and returns the code point starting at str[index]. index
    is advanced to one past the decoded code point. If the code point is not
    well-formed, then a UTFException is thrown and index remains
    unchanged.
						
				dchar decode(Flag!("useReplacementDchar") useReplacementDchar = No
				  auto ref S str,
				
				  ref size_t index
				
				)
				
				if (!isSomeString!S && isRandomAccessRange!S && hasSlicing!S && hasLength!S && isSomeChar!(ElementType!S));
				
				
				dchar decode(Flag!("useReplacementDchar") useReplacementDchar = No
				  auto ref S str,
				
				  ref size_t index
				
				) pure @trusted
				
				if (isSomeString!S);
						
					
				decode will only work with strings and random access ranges of code units
    with length and slicing, whereas decodeFront will work with any
    input range of code units.
Parameters
| Name | Description | 
|---|---|
| useReplacementDchar | if invalid UTF, return replacementDchar rather than throwing | 
| str | input string or indexable Range | 
| index | starting index into s[]; incremented by number of code units processed | 
Returns
decoded character
Throws
UTFException if str[index] is not the start of a valid UTF
        sequence and useReplacementDchar is No
Example
size_t i;
assert("a"Authors
License
					Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.