Mercurial > projects > dstep
annotate dstep/internal/String.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 033d260cfc9b |
children |
rev | line source |
---|---|
1 | 1 /** |
2 * Copyright: Copyright (c) 2008-2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: 2008 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.internal.String; | |
8 | |
9 public import dstep.internal.collection.Array; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
10 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
11 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
12 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
13 static import tango.stdc.stringz; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
14 import tango.text.Unicode : toFold, isDigit; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
15 import tango.text.convert.Utf; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
16 import tango.text.Util; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
17 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
18 alias tango.stdc.stringz.toStringz toStringz; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
19 alias tango.stdc.stringz.toString16z toString16z; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
20 alias tango.stdc.stringz.toString32z toString32z; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
21 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
22 alias tango.stdc.stringz.fromStringz fromStringz; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
23 alias tango.stdc.stringz.fromString16z fromString16z; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
24 alias tango.stdc.stringz.fromString32z fromString32z; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
25 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
26 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
27 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
28 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
29 import std.string; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
30 import std.utf; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
31 import std.ctype : isxdigit; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
32 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
33 version = Phobos; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
34 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
35 alias tolower toFold; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
36 alias toUTF16 toString16; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
37 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
38 alias std.string.tolower toFold; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
39 alias std.utf.toUTF16 toString16; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
40 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
41 alias std.string.toStringz toStringz; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
42 alias std.utf.toUTF16z toString16z; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
43 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
44 alias std.string.toString fromStringz; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
45 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
46 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
47 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
48 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
49 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
50 * string alias |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
51 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
52 alias char[] string; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
53 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
54 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
55 * wstring alias |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
56 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
57 alias wchar[] wstring; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
58 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
59 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
60 * dstring alias |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
61 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
62 alias dchar[] dstring; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
63 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
64 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
65 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
66 * Compares the $(D_PSYMBOL string) to another $(D_PSYMBOL string), ignoring case |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
67 * considerations. Two strings are considered equal ignoring case if they are of the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
68 * same length and corresponding characters in the two strings are equal ignoring case. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
69 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
70 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
71 * str = The $(D_PSYMBOL string) first string to compare to |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
72 * anotherString = The $(D_PSYMBOL string) to compare the first $(D_PSYMBOL string) with |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
73 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
74 * Returns: $(D_KEYWORD true) if the arguments is not $(D_KEYWORD null) and it |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
75 * represents an equivalent $(D_PSYMBOL string) ignoring case; $(D_KEYWORD false) otherwise |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
76 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
77 * Throws: AssertException if the length of any of the strings is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
78 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
79 * See_Also: opEquals(Object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
80 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
81 bool equalsIgnoreCase (string str, string anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
82 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
83 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
84 assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
85 assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
86 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
87 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
88 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
89 if (str == anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
90 return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
91 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
92 return toFold(str) == toFold(anotherString); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
93 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
94 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
95 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
96 * Compares the $(D_PSYMBOL wstring) to another $(D_PSYMBOL wstring), ignoring case |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
97 * considerations. Two wstrings are considered equal ignoring case if they are of the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
98 * same length and corresponding characters in the two wstrings are equal ignoring case. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
99 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
100 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
101 * str = The $(D_PSYMBOL wstring) first string to compre to |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
102 * anotherString = The $(D_PSYMBOL wstring) to compare the first $(D_PSYMBOL wstring) against |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
103 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
104 * Returns: $(D_KEYWORD true) if the argument is not $(D_KEYWORD null) and it |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
105 * represents an equivalent $(D_PSYMBOL wstring) ignoring case; (D_KEYWORD |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
106 * false) otherwise |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
107 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
108 * Throws: AssertException if the length of any of the wstrings is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
109 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
110 * See_Also: opEquals(Object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
111 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
112 bool equalsIgnoreCase (wstring str, wstring anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
113 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
114 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
115 assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
116 assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
117 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
118 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
119 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
120 if (str == anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
121 return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
122 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
123 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
124 return toFold(str) == toFold(anotherString); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
125 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
126 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
127 return toFold(toUTF8(str)) == toFold(toUTF8(anotherString)); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
128 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
129 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
130 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
131 * Compares the $(D_PSYMBOL dstring) to another $(D_PSYMBOL dstring), ignoring case |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
132 * considerations. Two wstrings are considered equal ignoring case if they are of the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
133 * same length and corresponding characters in the two wstrings are equal ignoring case. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
134 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
135 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
136 * str = The $(D_PSYMBOL dstring) first string to compare to |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
137 * anotherString = The $(D_PSYMBOL wstring) to compare the first $(D_PSYMBOL dstring) against |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
138 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
139 * Returns: $(D_KEYWORD true) if the argument is not $(D_KEYWORD null) and it |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
140 * represents an equivalent $(D_PSYMBOL dstring) ignoring case; $(D_KEYWORD false) otherwise |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
141 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
142 * Throws: AssertException if the length of any of the dstrings are 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
143 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
144 * See_Also: opEquals(Object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
145 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
146 bool equalsIgnoreCase (dstring str, dstring anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
147 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
148 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
149 assert(str.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the first string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
150 assert(anotherString.length > 0, "dstep.internal.String.equalsIgnoreCase: The length of the second string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
151 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
152 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
153 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
154 if (str == anotherString) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
155 return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
156 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
157 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
158 return toFold(str) == toFold(anotherString); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
159 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
160 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
161 return toFold(toUTF8(str)) == toFold(toUTF8(anotherString)); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
162 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
163 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
164 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
165 * Returns the char value at the specified index. An index ranges from 0 to length - 1. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
166 * The first $(D_KEYWORD char) value of the sequence is at index 0, the next at index 1, |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
167 * and so on, as for array indexing. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
168 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
169 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
170 * str = the string to get the $(D_KEYWORD char) from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
171 * index = the index of the $(D_KEYWORD char) value. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
172 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
173 * Returns: the $(D_KEYWORD char) value at the specified index of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
174 * The first $(D_KEYWORD char) value is at index 0. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
175 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
176 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
177 * Throws: AssertException if the $(D_CODE index) argument is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
178 * not less than the length of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
179 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
180 char charAt (string str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
181 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
182 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
183 assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
184 assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
185 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
186 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
187 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
188 return str[index]; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
189 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
190 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
191 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
192 * Returns the $(D_KEYWORD char) value at the specified index. An index ranges from 0 to |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
193 * length - 1. The first $(D_KEYWORD char) value of the sequence is at index 0, the next |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
194 * at index 1, and so on, as for array indexing. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
195 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
196 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
197 * str = the wstring to get the $(D_KEYWORD char) from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
198 * index = the index of the $(D_KEYWORD char) value. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
199 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
200 * Returns: the $(D_KEYWORD char) value at the specified index of the wstring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
201 * The first $(D_KEYWORD char) value is at index 0. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
202 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
203 * Throws: AssertException if the length of the wstring is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
204 * Throws: AssertException if the $(D_CODE index) argument is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
205 * not less than the length of the wstring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
206 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
207 wchar charAt (wstring str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
208 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
209 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
210 assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
211 assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
212 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
213 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
214 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
215 return str[index]; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
216 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
217 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
218 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
219 * Returns the $(D_KEYWORD char) value at the specified index. An index ranges from 0 to |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
220 * length - 1. The first $(D_KEYWORD char) value of the sequence is at index 0, the next |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
221 * at index 1, and so on, as for array indexing. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
222 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
223 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
224 * str = the dstring to get the $(D_KEYWORD char) from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
225 * index = the index of the $(D_KEYWORD char) value. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
226 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
227 * Returns: the $(D_KEYWORD char) value at the specified index of the dstring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
228 * The first $(D_KEYWORD char) value is at index 0. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
229 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
230 * Throws: AssertException if the length of the dstring is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
231 * Throws: AssertException if the $(D_CODE index) argument is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
232 * not less than the length of the dstring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
233 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
234 dchar charAt (dstring str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
235 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
236 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
237 assert(str.length > 0, "dstep.internal.String.charAt: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
238 assert(index <= str.length, "dstep.internal.String.charAt: The index was to greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
239 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
240 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
241 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
242 return str[index]; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
243 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
244 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
245 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
246 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
247 * at the specified $(D_PARAM beginIndex) and extends to the character at index |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
248 * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
249 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
250 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
251 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
252 * "hamburger".substring(4, 8) returns "urge" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
253 * "smiles".substring(1, 5) returns "mile" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
254 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
255 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
256 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
257 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
258 * beginIndex = the beginning index, inclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
259 * endIndex = the ending index, exclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
260 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
261 * Returns: the specified substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
262 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
263 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
264 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
265 * larger than $(D_PARAM endIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
266 * Throws: AssertException if $(D_PARAM endIndex) is larger than the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
267 * length of the $(D_PSYMBOL string). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
268 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
269 string substring (string str, size_t beginIndex, size_t endIndex) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
270 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
271 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
272 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
273 assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
274 assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
275 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
276 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
277 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
278 return str[beginIndex .. endIndex].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
279 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
280 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
281 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
282 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
283 * at the specified $(D_PARAM beginIndex) and extends to the character at index |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
284 * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
285 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
286 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
287 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
288 * "hamburger".substring(4, 8) returns "urge" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
289 * "smiles".substring(1, 5) returns "mile" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
290 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
291 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
292 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
293 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
294 * beginIndex = the beginning index, inclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
295 * endIndex = the ending index, exclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
296 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
297 * Returns: the specified substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
298 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
299 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
300 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
301 * larger than $(D_PARAM endIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
302 * Throws: AssertException if $(D_PARAM endIndex) is larger than the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
303 * length of the $(D_PSYMBOL string). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
304 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
305 wstring substring (wstring str, size_t beginIndex, size_t endIndex) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
306 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
307 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
308 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
309 assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
310 assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
311 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
312 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
313 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
314 return str[beginIndex .. endIndex].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
315 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
316 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
317 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
318 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
319 * at the specified $(D_PARAM beginIndex) and extends to the character at index |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
320 * $(D_PARAM endIndex) - 1. Thus the length of the substring is $(D_PARAM endIndex - beginIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
321 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
322 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
323 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
324 * "hamburger".substring(4, 8) returns "urge" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
325 * "smiles".substring(1, 5) returns "mile" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
326 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
327 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
328 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
329 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
330 * beginIndex = the beginning index, inclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
331 * endIndex = the ending index, exclusive. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
332 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
333 * Returns: the specified substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
334 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
335 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
336 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
337 * larger than $(D_PARAM endIndex). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
338 * Throws: AssertException if $(D_PARAM endIndex) is larger than the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
339 * length of the $(D_PSYMBOL string). |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
340 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
341 dstring substring (dstring str, size_t beginIndex, size_t endIndex) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
342 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
343 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
344 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
345 assert(beginIndex < endIndex, "dstep.internal.String.substring: The first index was greater the second"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
346 assert(endIndex <= str.length, "dstep.internal.String.substring: The second index was greater then the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
347 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
348 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
349 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
350 return str[beginIndex .. endIndex].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
351 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
352 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
353 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
354 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
355 * with the character at the specified index and extends to the end of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
356 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
357 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
358 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
359 * "unhappy".substring(2) returns "happy" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
360 * "Harbison".substring(3) returns "bison" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
361 * "emptiness".substring(9) returns "" (an empty string) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
362 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
363 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
364 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
365 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
366 * beginIndex = the beginning index, inclusive |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
367 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
368 * Returns: the specified substring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
369 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
370 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
371 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
372 * larger than the length of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
373 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
374 string substring (string str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
375 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
376 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
377 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
378 assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
379 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
380 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
381 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
382 return str.substring(index, str.length); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
383 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
384 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
385 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
386 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
387 * with the character at the specified index and extends to the end of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
388 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
389 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
390 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
391 * "unhappy".substring(2) returns "happy" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
392 * "Harbison".substring(3) returns "bison" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
393 * "emptiness".substring(9) returns "" (an empty string) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
394 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
395 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
396 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
397 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
398 * beginIndex = the beginning index, inclusive |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
399 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
400 * Returns: the specified substring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
401 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
402 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
403 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
404 * larger than the length of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
405 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
406 wstring substring (wstring str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
407 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
408 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
409 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
410 assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
411 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
412 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
413 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
414 return str.substring(index, str.length); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
415 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
416 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
417 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
418 * Returns a new string that is a substring of the specified string. The substring begins |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
419 * with the character at the specified index and extends to the end of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
420 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
421 * Examples: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
422 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
423 * "unhappy".substring(2) returns "happy" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
424 * "Harbison".substring(3) returns "bison" |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
425 * "emptiness".substring(9) returns "" (an empty string) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
426 * --- |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
427 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
428 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
429 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
430 * beginIndex = the beginning index, inclusive |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
431 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
432 * Returns: the specified substring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
433 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
434 * Throws: AssertException if the length of the string is 0 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
435 * Throws: AssertException if the $(D_PARAM beginIndex) is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
436 * larger than the length of the string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
437 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
438 dstring substring (dstring str, size_t index) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
439 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
440 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
441 assert(str.length > 0, "dstep.internal.String.substring: The length of the string was 0"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
442 assert(index < str.length, "dstep.internal.String.substring: The index was greater than the length of the string"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
443 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
444 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
445 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
446 return str.substring(index, str.length); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
447 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
448 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
449 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
450 * Returns a new string that is a substring of the given string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
451 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
452 * This substring is the character sequence that starts at character |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
453 * position pos and has a length of n characters. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
454 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
455 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
456 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
457 * pos = position of a character in the current string to be used |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
458 * as starting character for the substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
459 * n = Length of the substring. If this value would make the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
460 * substring to span past the end of the current string content, |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
461 * only those characters until the end of the string are used. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
462 * size_t.max is the greatest possible value for an element of |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
463 * type size_t, therefore, when this value is used, all the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
464 * characters between pos and the end of the string are used as |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
465 * the initialization substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
466 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
467 * Returns: a string containing a substring of the given string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
468 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
469 * Throws: AssertException if pos is greater than the length of the string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
470 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
471 string substr (string str, size_t pos = 0, size_t n = size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
472 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
473 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
474 assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
475 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
476 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
477 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
478 size_t end; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
479 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
480 if (n == size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
481 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
482 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
483 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
484 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
485 end = pos + n; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
486 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
487 if (end > str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
488 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
489 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
490 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
491 return str[pos .. end].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
492 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
493 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
494 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
495 * Returns a new string that is a substring of the given string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
496 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
497 * This substring is the character sequence that starts at character |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
498 * position pos and has a length of n characters. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
499 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
500 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
501 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
502 * pos = position of a character in the current string to be used |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
503 * as starting character for the substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
504 * n = Length of the substring. If this value would make the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
505 * substring to span past the end of the current string content, |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
506 * only those characters until the end of the string are used. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
507 * size_t.max is the greatest possible value for an element of |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
508 * type size_t, therefore, when this value is used, all the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
509 * characters between pos and the end of the string are used as |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
510 * the initialization substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
511 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
512 * Returns: a string containing a substring of the given string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
513 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
514 * Throws: AssertException if pos is greater than the length of the string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
515 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
516 wstring substr (wstring str, size_t pos = 0, size_t n = size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
517 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
518 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
519 assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
520 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
521 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
522 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
523 size_t end; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
524 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
525 if (n == size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
526 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
527 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
528 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
529 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
530 end = pos + n; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
531 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
532 if (end > str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
533 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
534 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
535 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
536 return str[pos .. end].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
537 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
538 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
539 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
540 * Returns a new string that is a substring of the given string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
541 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
542 * This substring is the character sequence that starts at character |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
543 * position pos and has a length of n characters. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
544 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
545 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
546 * str = the string to get the substring from |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
547 * pos = position of a character in the current string to be used |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
548 * as starting character for the substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
549 * n = Length of the substring. If this value would make the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
550 * substring to span past the end of the current string content, |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
551 * only those characters until the end of the string are used. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
552 * size_t.max is the greatest possible value for an element of |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
553 * type size_t, therefore, when this value is used, all the |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
554 * characters between pos and the end of the string are used as |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
555 * the initialization substring. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
556 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
557 * Returns: a string containing a substring of the given string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
558 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
559 * Throws: AssertException if pos is greater than the length of the string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
560 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
561 dstring substr (dstring str, size_t pos = 0, size_t n = size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
562 in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
563 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
564 assert(pos < str.length, "dstep.internal.String.substr: The given position was greater than the length of the string."); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
565 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
566 body |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
567 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
568 size_t end; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
569 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
570 if (n == size_t.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
571 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
572 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
573 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
574 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
575 end = pos + n; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
576 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
577 if (end > str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
578 end = str.length; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
579 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
580 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
581 return str[pos .. end].dup; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
582 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
583 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
584 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
585 * Finds the first occurence of sub in str |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
586 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
587 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
588 * str = the string to find in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
589 * sub = the substring to find |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
590 * start = where to start finding |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
591 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
592 * Returns: the index of the substring or size_t.max when nothing was found |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
593 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
594 size_t find (string str, string sub, size_t start = 0) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
595 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
596 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
597 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
598 size_t index = str.locatePattern(sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
599 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
600 if (index == str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
601 return size_t.max; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
602 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
603 return index; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
604 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
605 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
606 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
607 return std.string.find(str, sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
608 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
609 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
610 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
611 * Finds the first occurence of sub in str |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
612 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
613 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
614 * str = the string to find in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
615 * sub = the substring to find |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
616 * start = where to start finding |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
617 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
618 * Returns: the index of the substring or size_t.max when nothing was found |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
619 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
620 size_t find (wstring str, wstring sub, size_t start = 0) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
621 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
622 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
623 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
624 size_t index = str.locatePattern(sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
625 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
626 if (index == str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
627 return size_t.max; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
628 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
629 return index; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
630 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
631 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
632 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
633 return std.string.find(str, sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
634 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
635 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
636 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
637 * Finds the first occurence of sub in str |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
638 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
639 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
640 * str = the string to find in |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
641 * sub = the substring to find |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
642 * start = where to start finding |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
643 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
644 * Returns: the index of the substring or size_t.max when nothing was found |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
645 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
646 size_t find (dstring str, dstring sub, size_t start = 0) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
647 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
648 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
649 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
650 size_t index = str.locatePattern(sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
651 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
652 if (index == str.length) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
653 return size_t.max; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
654 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
655 return index; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
656 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
657 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
658 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
659 return std.string.find(str, sub, start); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
660 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
661 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
662 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
663 * Compares to strings, ignoring case differences. Returns 0 if the content |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
664 * matches, less than zero if a is "less" than b, or greater than zero |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
665 * where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
666 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
667 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
668 * a = the first array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
669 * b = the second array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
670 * end = the index where the comparision will end |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
671 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
672 * Returns: Returns 0 if the content matches, less than zero if a is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
673 * "less" than b, or greater than zero where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
674 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
675 * See_Also: dstep.internal.collection.array.compare |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
676 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
677 int compareIgnoreCase (U = size_t) (string a, string b, U end = U.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
678 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
679 return a.toFold().compare(b.toFold(), end); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
680 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
681 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
682 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
683 * Compares to strings, ignoring case differences. Returns 0 if the content |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
684 * matches, less than zero if a is "less" than b, or greater than zero |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
685 * where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
686 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
687 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
688 * a = the first array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
689 * b = the second array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
690 * end = the index where the comparision will end |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
691 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
692 * Returns: Returns 0 if the content matches, less than zero if a is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
693 * "less" than b, or greater than zero where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
694 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
695 * See_Also: dstep.internal.collection.array.compare |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
696 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
697 int compareIgnoreCase (U = size_t) (wstring a, wstring b, U end = U.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
698 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
699 return a.toFold().compare(b.toFold(), end); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
700 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
701 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
702 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
703 * Compares to strings, ignoring case differences. Returns 0 if the content |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
704 * matches, less than zero if a is "less" than b, or greater than zero |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
705 * where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
706 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
707 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
708 * a = the first array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
709 * b = the second array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
710 * end = the index where the comparision will end |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
711 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
712 * Returns: Returns 0 if the content matches, less than zero if a is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
713 * "less" than b, or greater than zero where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
714 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
715 * See_Also: dstep.internal.collection.array.compare |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
716 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
717 int compareIgnoreCase (U = size_t) (dstring a, dstring b, U end = U.max) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
718 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
719 return a.toFold().compare(b.toFold(), end); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
720 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
721 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
722 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
723 * Compares to strings, ignoring case differences. Returns 0 if the content |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
724 * matches, less than zero if a is "less" than b, or greater than zero |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
725 * where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
726 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
727 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
728 * a = the first array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
729 * b = the second array |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
730 * end = the index where the comparision will end |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
731 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
732 * Returns: Returns 0 if the content matches, less than zero if a is |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
733 * "less" than b, or greater than zero where a is "bigger". |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
734 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
735 * See_Also: dstep.internal.String.compareIgnoreCase |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
736 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
737 alias compareIgnoreCase icompare; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
738 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
739 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
740 * Checks if the given character is a hexdecimal digit character. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
741 * Hexadecimal digits are any of: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
742 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
743 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
744 * ch = the character to be checked |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
745 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
746 * Returns: true if the given character is a hexdecimal digit character otherwise false |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
747 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
748 bool isHexDigit (dchar ch) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
749 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
750 version (Tango) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
751 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
752 switch (ch) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
753 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
754 case 'A': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
755 case 'B': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
756 case 'C': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
757 case 'D': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
758 case 'E': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
759 case 'F': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
760 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
761 case 'a': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
762 case 'b': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
763 case 'c': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
764 case 'd': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
765 case 'e': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
766 case 'f': return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
767 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
768 default: break; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
769 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
770 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
771 if (isDigit(ch)) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
772 return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
773 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
774 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
775 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
776 if (isxdigit(ch) != 0) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
777 return true; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
778 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
779 return false; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
780 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
781 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
782 version (Phobos) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
783 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
784 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
785 * Converts the given string to C-style 0 terminated string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
786 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
787 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
788 * str = the string to convert |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
789 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
790 * Returns: the a C-style 0 terminated string. |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
791 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
792 dchar* toString32z (dstring str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
793 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
794 return (str ~ '\0').ptr; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
795 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
796 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
797 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
798 * Converts a C-style 0 terminated string to a wstring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
799 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
800 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
801 * str = the C-style 0 terminated string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
802 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
803 * Returns: the converted wstring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
804 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
805 wstring fromString16z (wchar* str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
806 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
807 return str[0 .. strlen(str)]; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
808 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
809 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
810 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
811 * Converts a C-style 0 terminated string to a dstring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
812 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
813 * str = the C-style 0 terminated string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
814 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
815 * Returns: the converted dstring |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
816 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
817 dstring fromString32z (dchar* str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
818 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
819 return str[0 .. strlen(str)]; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
820 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
821 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
822 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
823 * Gets the length of the given C-style 0 terminated string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
824 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
825 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
826 * str = the C-style 0 terminated string to get the length of |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
827 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
828 * Returns: the length of the string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
829 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
830 size_t strlen (wchar* str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
831 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
832 size_t i = 0; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
833 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
834 if (str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
835 while(*str++) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
836 ++i; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
837 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
838 return i; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
839 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
840 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
841 /** |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
842 * Gets the length of the given C-style 0 terminated string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
843 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
844 * Params: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
845 * str = the C-style 0 terminated string to get the length of |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
846 * |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
847 * Returns: the length of the string |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
848 */ |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
849 size_t strlen (dchar* str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
850 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
851 size_t i = 0; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
852 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
853 if (str) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
854 while(*str++) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
855 ++i; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
856 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
857 return i; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
858 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
859 } |