Lines Matching refs:StringUtils

17 import {StringUtils} from './string_utils';
21 expect(StringUtils.parseBigIntStrippingUnit('-10')).toEqual(-10n);
22 expect(StringUtils.parseBigIntStrippingUnit('-10 unit')).toEqual(-10n);
23 expect(StringUtils.parseBigIntStrippingUnit('-10unit')).toEqual(-10n);
24 expect(StringUtils.parseBigIntStrippingUnit(' -10 unit ')).toEqual(-10n);
26 expect(StringUtils.parseBigIntStrippingUnit('0')).toEqual(0n);
27 expect(StringUtils.parseBigIntStrippingUnit('0 unit')).toEqual(0n);
28 expect(StringUtils.parseBigIntStrippingUnit('0unit')).toEqual(0n);
29 expect(StringUtils.parseBigIntStrippingUnit(' 0 unit ')).toEqual(0n);
31 expect(StringUtils.parseBigIntStrippingUnit('10')).toEqual(10n);
32 expect(StringUtils.parseBigIntStrippingUnit('10 unit')).toEqual(10n);
33 expect(StringUtils.parseBigIntStrippingUnit('10unit')).toEqual(10n);
34 expect(StringUtils.parseBigIntStrippingUnit(' 10 unit ')).toEqual(10n);
36 expect(() => StringUtils.parseBigIntStrippingUnit('invalid')).toThrow();
38 StringUtils.parseBigIntStrippingUnit('invalid 10 unit'),
43 expect(StringUtils.convertCamelToSnakeCase('aaa')).toEqual('aaa');
44 expect(StringUtils.convertCamelToSnakeCase('Aaa')).toEqual('Aaa');
45 expect(StringUtils.convertCamelToSnakeCase('_aaa')).toEqual('_aaa');
46 expect(StringUtils.convertCamelToSnakeCase('_Aaa')).toEqual('_Aaa');
48 expect(StringUtils.convertCamelToSnakeCase('aaaBbb')).toEqual('aaa_bbb');
49 expect(StringUtils.convertCamelToSnakeCase('AaaBbb')).toEqual('Aaa_bbb');
50 expect(StringUtils.convertCamelToSnakeCase('aaa_bbb')).toEqual('aaa_bbb');
51 expect(StringUtils.convertCamelToSnakeCase('aaa_Bbb')).toEqual('aaa_Bbb');
53 expect(StringUtils.convertCamelToSnakeCase('aaaBbbCcc')).toEqual(
56 expect(StringUtils.convertCamelToSnakeCase('aaaBbb_ccc')).toEqual(
59 expect(StringUtils.convertCamelToSnakeCase('aaaBbb_Ccc')).toEqual(
63 expect(StringUtils.convertCamelToSnakeCase('aaaBBBccc')).toEqual(
66 expect(StringUtils.convertCamelToSnakeCase('aaaBBBcccDDD')).toEqual(
69 expect(StringUtils.convertCamelToSnakeCase('aaaBBB_ccc')).toEqual(
72 expect(StringUtils.convertCamelToSnakeCase('aaaBbb_CCC')).toEqual(
76 expect(StringUtils.convertCamelToSnakeCase('_field_32')).toEqual(
79 expect(StringUtils.convertCamelToSnakeCase('field_32')).toEqual('field_32');
80 expect(StringUtils.convertCamelToSnakeCase('field_32Bits')).toEqual(
83 expect(StringUtils.convertCamelToSnakeCase('field_32BitsLsb')).toEqual(
86 expect(StringUtils.convertCamelToSnakeCase('field_32bits')).toEqual(
89 expect(StringUtils.convertCamelToSnakeCase('field_32bitsLsb')).toEqual(
93 expect(StringUtils.convertCamelToSnakeCase('_aaaAaa.bbbBbb')).toEqual(
96 expect(StringUtils.convertCamelToSnakeCase('aaaAaa.bbbBbb')).toEqual(
100 StringUtils.convertCamelToSnakeCase('aaaAaa.field_32bitsLsb.bbbBbb'),
105 expect(StringUtils.convertSnakeToCamelCase('_aaa')).toEqual('_aaa');
106 expect(StringUtils.convertSnakeToCamelCase('aaa')).toEqual('aaa');
108 expect(StringUtils.convertSnakeToCamelCase('aaa_bbb')).toEqual('aaaBbb');
109 expect(StringUtils.convertSnakeToCamelCase('_aaa_bbb')).toEqual('_aaaBbb');
111 expect(StringUtils.convertSnakeToCamelCase('aaa_bbb_ccc')).toEqual(
114 expect(StringUtils.convertSnakeToCamelCase('_aaa_bbb_ccc')).toEqual(
118 expect(StringUtils.convertSnakeToCamelCase('_field_32')).toEqual(
121 expect(StringUtils.convertSnakeToCamelCase('field_32')).toEqual('field_32');
122 expect(StringUtils.convertSnakeToCamelCase('field_32_bits')).toEqual(
125 expect(StringUtils.convertSnakeToCamelCase('field_32_bits_lsb')).toEqual(
128 expect(StringUtils.convertSnakeToCamelCase('field_32bits')).toEqual(
131 expect(StringUtils.convertSnakeToCamelCase('field_32bits_lsb')).toEqual(
135 expect(StringUtils.convertSnakeToCamelCase('_aaa_aaa.bbb_bbb')).toEqual(
138 expect(StringUtils.convertSnakeToCamelCase('aaa_aaa.bbb_bbb')).toEqual(
142 StringUtils.convertSnakeToCamelCase('aaa_aaa.field_32bits_lsb.bbb_bbb'),
147 expect(StringUtils.isAlpha('a')).toBeTrue();
148 expect(StringUtils.isAlpha('A')).toBeTrue();
149 expect(StringUtils.isAlpha('_')).toBeFalse();
150 expect(StringUtils.isAlpha('0')).toBeFalse();
151 expect(StringUtils.isAlpha('9')).toBeFalse();
155 expect(StringUtils.isDigit('a')).toBeFalse();
156 expect(StringUtils.isDigit('A')).toBeFalse();
157 expect(StringUtils.isDigit('_')).toBeFalse();
158 expect(StringUtils.isDigit('0')).toBeTrue();
159 expect(StringUtils.isDigit('9')).toBeTrue();
163 expect(StringUtils.isLowerCase('a')).toBeTrue();
164 expect(StringUtils.isLowerCase('z')).toBeTrue();
165 expect(StringUtils.isLowerCase('A')).toBeFalse();
166 expect(StringUtils.isLowerCase('Z')).toBeFalse();
167 expect(StringUtils.isLowerCase('_')).toBeFalse();
168 expect(StringUtils.isLowerCase('0')).toBeFalse();
169 expect(StringUtils.isLowerCase('9')).toBeFalse();
173 expect(StringUtils.isUpperCase('A')).toBeTrue();
174 expect(StringUtils.isUpperCase('Z')).toBeTrue();
175 expect(StringUtils.isUpperCase('a')).toBeFalse();
176 expect(StringUtils.isUpperCase('z')).toBeFalse();
177 expect(StringUtils.isUpperCase('_')).toBeFalse();
178 expect(StringUtils.isUpperCase('0')).toBeFalse();
179 expect(StringUtils.isUpperCase('9')).toBeFalse();
183 expect(StringUtils.isBlank('')).toBeTrue();
184 expect(StringUtils.isBlank(' ')).toBeTrue();
185 expect(StringUtils.isBlank(' ')).toBeTrue();
186 expect(StringUtils.isBlank(' a')).toBeFalse();
187 expect(StringUtils.isBlank('a ')).toBeFalse();
188 expect(StringUtils.isBlank(' a ')).toBeFalse();
189 expect(StringUtils.isBlank('a a')).toBeFalse();
193 expect(StringUtils.isNumeric('0')).toBeTrue();
194 expect(StringUtils.isNumeric('1')).toBeTrue();
195 expect(StringUtils.isNumeric('0.1')).toBeTrue();
196 expect(StringUtils.isNumeric('')).toBeFalse();
197 expect(StringUtils.isNumeric('a')).toBeFalse();
198 expect(StringUtils.isNumeric('4n')).toBeFalse();