isOneSymbolPerFieldAccessString

check symbol count for access to field

pure
bool
isOneSymbolPerFieldAccessString
(
string str
,
string sep = ""
)

Examples

Using all functions

1 static assert(  isValueAccessString( "hello" ) );
2 static assert(  isValueAccessString( "x" ) );
3 static assert(  isValueAccessString( "_ok" ) );
4 static assert(  isValueAccessString( "__ok" ) );
5 static assert(  isValueAccessString( "__o1k" ) );
6 static assert(  isValueAccessString( "_2o1k3" ) );
7 static assert( !isValueAccessString( "0__ok" ) );
8 static assert( !isValueAccessString( "__o-k" ) );
9 static assert(  isArrayAccessString( "xyz" ) );
10 static assert(  isArrayAccessString( "x|dx|y|dy", "|" ) );
11 static assert(  isCompatibleArrayAccessString( 4, "x|dx|y|dy", "|" ) );
12 static assert(  isCompatibleArrayAccessString( 3, "xyz" ) );
13 static assert( !isCompatibleArrayAccessString( 4, "xxxy" ) );
14 static assert( !isCompatibleArrayAccessString( 3, "xxx" ) );
15 static assert(  isCompatibleArrayAccessStrings( 3, "xyz" ) );
16 static assert(  isCompatibleArrayAccessStrings( 3, "x y z", " " ) );
17 static assert(  isCompatibleArrayAccessStrings( 2, "xy|uv" ) );
18 static assert(  isCompatibleArrayAccessStrings( 3, "abc|efg" ) );
19 static assert( !isCompatibleArrayAccessStrings( 3, "abc|afg" ) );
20 static assert( !isCompatibleArrayAccessStrings( 3, "xxy|uv" ) );
21 static assert(  isCompatibleArrayAccessStrings( 3, "x,y,z;u,v,t", ",", ";" ) );
22 static assert( getIndex( "x y z", "x", " " ) == 0 );
23 static assert( getIndex( "x y z", "y", " " ) == 1 );
24 static assert( getIndex( "x y z", "z", " " ) == 2 );
25 static assert( getIndex( "x|dx|y|dy", "dx", "|", ";" ) == 1 );
26 static assert( getIndex( "x|dx|y|dy", "1dx", "|", ";" ) == -1 );
27 
28 static assert( oneOfAccessAll("xyz","xy") );
29 static assert( oneOfAccessAll("xyz","yx") );
30 static assert( oneOfAccessAll("xyz","xxxxyxyyyz") );
31 static assert( oneOfAccessAll("x,y,z","xxxxyxyyyz",",") );
32 static assert( isOneSymbolPerFieldAccessString("xyz") );
33 static assert( isOneSymbolPerFieldAccessString("x,y,z",",") );
34 static assert( isOneSymbolPerFieldForAnyAccessString( "xy|uv", "", "|" ) );
35 static assert( isOneSymbolPerFieldForAnyAccessString( "near far|n f", " ", "|" ) );
36 
37 static assert( !isArrayAccessString("x.y.z","",false) );
38 static assert( !isArrayAccessString("x.y.z","",true) );
39 static assert( !isArrayAccessString("x.y.z"," ",false) );
40 static assert(  isArrayAccessString("x.y.z"," ",true) );
41 static assert(  isArrayAccessString("pos.x pos.y pos.z vel.x vel.y vel.z"," ",true) );
42 
43 static assert(  isArrayAccessString( "pos vel", " ", true ) );
44 static assert(  isArrayAccessString( "abcd", " ", true ) );
45 static assert(  isArrayAccessString( "a1 a2", " ", true ) );
46 static assert(  isArrayAccessString( "ok.no", " ", true ) );
47 auto fstr = "pos.x pos.y vel.x vel.y";
48 assert(  isArrayAccessString( fstr, " ", true ) );
49 assert( !isArrayAccessString( fstr[0 .. $-1], " ", true ) );
50 assert( !isArrayAccessString( "ok.1", " ", true ) );
51 assert( !isArrayAccessString( "1abcd", " ", true ) );
52 assert( !isArrayAccessString( "not 2ok", " ", true ) );

Meta