Skip to content

Commit

Permalink
Merge pull request #8 from tharakamd/whitespace_support
Browse files Browse the repository at this point in the history
add whitespace sepeartors
  • Loading branch information
tharakamd authored Apr 8, 2021
2 parents 8e9e94a + 47bd3d8 commit 98bd092
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/csv_to_csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ To transform a CSV payload to another CSV payload in a different format you can
Specify whether the CSV input has a header row. This accepts **Absent** or **Present** as values. The Default value
is **Absent**.
* valueSeparator (Separator):
Specify the separator to use in the CSV input. Default is the `,` (comma).
Specify the separator to use in the CSV input. Default is the `,` (comma). To use tab as the separator, use the
value `tab` to this property. To use space, use the value `space`.
* skipHeader (Skip Headers): Skip the header row or not in the output CSV.
This property accepts **true** or **false** as values. The Default is false. This is available only if the value of
the `headerPresent` property is set to `Present`.
Expand Down
3 changes: 2 additions & 1 deletion docs/csv_to_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ You can use the csvToJson operation to transform a CSV payload in to a JSON payl
Specify whether the CSV input has a header row. This accepts **Absent** or **Present** as values. The Default value
is **Absent**.
* valueSeparator (Separator):
Specify the separator to use in the CSV input. Default is the `,` (comma).
Specify the separator to use in the CSV input. Default is the `,` (comma). To use tab as the separator, use the
value `tab` to this property. To use space, use the value `space`.
This property accepts **true** or **false** as values. The Default is false. This is available only if the value of
the `headerPresent` property is set to `Present`.
* columnsToSkip (Skip Columns):
Expand Down
3 changes: 2 additions & 1 deletion docs/csv_to_xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ You can use the csvToXml operation to transform a CSV payload in to an XML paylo
Specify whether the CSV input has a header row. This accepts **Absent** or **Present** as values. The Default
value is **Absent**.
* valueSeparator (Separator):
Specify the separator to use in the CSV input. Default is the `,` (comma).
Specify the separator to use in the CSV input. Default is the `,` (comma). To use tab as the separator, use the
value `tab` to this property. To use space, use the value `space`.
* skipHeader (Skip Headers): Skip the header row or not in the output CSV.
This property accepts **true** or **false** as values. The Default is false. This is available only if the value of
the `headerPresent` property is set to `Present`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ public static Optional<String> getStringParam(SimpleMessageContext mc, String pa
public static Optional<Character> getCharParam(SimpleMessageContext mc, String parameterKey) {

Optional<String> parameterValue = getStringParam(mc, parameterKey);
return parameterValue.map(s -> s.charAt(0));
return parameterValue.map(PropertyReader::replaceWhitespaces);
}

private static Character replaceWhitespaces(String text) {

if (text.equals("tab")) {
return 9;
} else if (text.equals("space")) {
return 32;
} else {
return text.charAt(0);
}
}

/**
Expand Down

0 comments on commit 98bd092

Please sign in to comment.