I have a string like this '\IonSubsystem1TRAN-88252' and I want to convert it to string like this: '\IonSubsystem1\TRAN-88252'.
How do I add the backslashes in the right spots in a generic way?
I have a string like this '\IonSubsystem1TRAN-88252' and I want to convert it to string like this: '\IonSubsystem1\TRAN-88252'.
How do I add the backslashes in the right spots in a generic way?
For this example the easiest way would be to use the .replace
function.
newString = string.replace('IonSubsystem1', 'IonSubsystem1\\');
Keep in mind that you need \\
since a single Backslash is interpreted as a escape character.
The simplest way I'd do it is by making the substring of the given string using javascript's substring method and appending an additional "/" after it.That is storing the acquired substr in a variable and + "/" after it.But again it depends how generic you want it to be.