MCPcopy
hub / github.com/questdb/questdb / trim

Method trim

core/src/main/java/io/questdb/std/Chars.java:1402–1422  ·  view source on GitHub ↗
(TrimType type, CharSequence str, StringSink sink)

Source from the content-addressed store, hash-verified

1400 }
1401
1402 public static void trim(TrimType type, CharSequence str, StringSink sink) {
1403 if (str == null) {
1404 return;
1405 }
1406 int startIdx = 0;
1407 int endIdx = str.length() - 1;
1408 if (type == TrimType.LTRIM || type == TrimType.TRIM) {
1409 while (startIdx < endIdx && str.charAt(startIdx) == ' ') {
1410 startIdx++;
1411 }
1412 }
1413 if (type == TrimType.RTRIM || type == TrimType.TRIM) {
1414 while (startIdx < endIdx && str.charAt(endIdx) == ' ') {
1415 endIdx--;
1416 }
1417 }
1418 sink.clear();
1419 if (startIdx != endIdx) {
1420 sink.put(str, startIdx, endIdx + 1);
1421 }
1422 }
1423
1424 public static void unescape(@NotNull CharSequence cs, int start, int end, char unescape, @NotNull Utf16Sink sink) {
1425 final int lastChar = end - 1;

Callers 15

parseCookiesMethod · 0.95
parseVarcharArrayMethod · 0.45
resolveParametersMethod · 0.45
parseVarcharArrayMethod · 0.45
executeQueryMethod · 0.45
resolveParametersMethod · 0.45
parseMethod · 0.45
validateConfigKeysMethod · 0.45
extractColumnNamesMethod · 0.45
assertWindowQueryMethod · 0.45

Calls 4

lengthMethod · 0.65
clearMethod · 0.65
putMethod · 0.65
charAtMethod · 0.45