Get the value of last 4 digits from a string
-
Hello
The user has a serial number (string) with 30 characters.
When the user inserts this serial into the plugin, I can get the whole serial input string with
getValue();
What about if I only want to get the last 4 characters of this input? Any helps appreciated.
-
You can use
.substring
that substracts the choosen values from a string. (Start index: Begins from 0) -
@Steve-Mohican You can use
var subString = String.substring(String.length - 4, String.length);
-
Wow that was quick, thank you guys, you've been very helpful, much respect!!