Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need to retrieve the last 3 characters before the extension of some files:
Example:
18_08_2020_Client_GBP.txt
19_08_2020_Client_EUR.txt
18_08_2020_Client_MUR.txt
Expected output:
GBP
EUR
MUR
Any idea of of how can this be done please?
Many thanks.
Best regards,
Duke
Try this in a tJava....
String value = "18_08_2020_Client_GBP.txt";
System.out.println(value.substring(value.lastIndexOf(".")-3, value.lastIndexOf(".")));
To use this you will either need to wrap it in a routine or simply use it in a tJavaRow/tJavaFlex. In a tJavaFlex, if your column holding the value is being connected via row1 and the column name is "value", the code would look like this.....
row2.country = row1.value.lastIndexOf(".")-3, row1.value.lastIndexOf("."));
Hope this helps
Try this in a tJava....
String value = "18_08_2020_Client_GBP.txt";
System.out.println(value.substring(value.lastIndexOf(".")-3, value.lastIndexOf(".")));
To use this you will either need to wrap it in a routine or simply use it in a tJavaRow/tJavaFlex. In a tJavaFlex, if your column holding the value is being connected via row1 and the column name is "value", the code would look like this.....
row2.country = row1.value.lastIndexOf(".")-3, row1.value.lastIndexOf("."));
Hope this helps