cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ralphster
Level 6

How do I remove a backslash from the end of a string?

 

Hello,

 How can I check to see if there is a backslash at the end of a string, and if there is then remove the backslash?

 My reason for asking is that I am able to find the path of my setup.exe executable using the code below. However if there is a backslash at the end of the path, I need to remove it. Does anyone know how I can do that?

szDir = PACKAGE_LOCATION;

ParsePath(strPathToInstallationDirectory,szDir,PATH)

// Note the above ParsePath command will store the directory path in strPathToInstallDir
// However there is a backslash at the end of the string : Ex: C:\Fulton\InstallationDir\

// I only need C:\Fulton\InstallationDir without the backslash at the end of the string.

 

Labels (1)
0 Kudos
(1) Reply
banna_k
Revenera
Revenera

Hi @ralphster ,

you can use StrRemoveLastSlash function to remove the last slash from the path string:

 more information can be found at the below link: 

https://helpnet.flexerasoftware.com/installshield21helplib/Subsystems/installshield21langref/helplibrary/LangrefStrRemoveLastSlash.htm#langref_appendixe_1272013458_1031679 

0 Kudos