The OpenD Programming Language

1 /++
2 	String manipulation functions.
3 
4 	See_Also:
5 		To get a substring, you can use the built-in array slice operator.
6 
7 		For reading various encodings into a standard string, see [arsd.characterencodings].
8 
9 		For converting things to and from strings, see [arsd.conv].
10 
11 		For sorting an array of strings, see... std.algorithm for now but maybe here later.
12 
13 	History:
14 		Added May 23, 2025
15 +/
16 module arsd..string;
17 
18 static import arsd.core;
19 
20 /// Public interface to arsd.core
21 alias startsWith = arsd.core.startsWith;
22 /// ditto
23 alias endsWith = arsd.core.endsWith;
24 /// ditto
25 alias indexOf = arsd.core.indexOf;
26 
27 // replace? replaceFirst, replaceAll, replaceAny etc
28 
29 // limitSize - truncates to the last code point under the given length of code units
30 
31 /// Strips (aka trims) leading and/or trailing whitespace from the string.
32 alias strip = arsd.core.stripInternal;
33 /// ditto
34 @deprecated("D calls this `strip` instead") alias trim = strip;
35 
36 /// ditto
37 alias stripRight = arsd.core.stripInternal;
38 /// ditto
39 @deprecated("D calls this `stripRight` instead") alias trimRight = stripRight;
40 
41 // stripLeft? variants where you can list the chars to strip?
42 
43 // ascii to upper, to lower, capitalize words, from camel case to dash separated
44 
45 // ********* UTF **************
46 // utf8 stride and such?
47 // get the starting code unit of the given point in the string
48 // get the next code unit start after the given point (compare upstream popFront)
49 // iterate over a string putting a replacement char in any invalid utf 8 spot
50 
51 // ********* C INTEROP **************
52 
53 alias stringz = arsd.core.stringz;
54 // CharzBuffer
55 // WCharzBuffer