This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- TrimEnd: removes occurences pf specified trim string from original string from end
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 11, 2008
07:13 AM
TrimStart: Removes all the occurence(s) of trim string from the original string
🙂 Function to remove occurences of certain string at start from the provided string.
prototype STRING TrimStart(STRING, STRING);
///
///Removes all occcurences of the trim string at the start of original
/// string.
///
///
function STRING TrimStart(szString, szTrim)
STRING szReturn;
begin
szReturn = szString;
while(StrFind(szReturn,szTrim) = 0)
StrSub(szReturn, szReturn, StrLength(szTrim), StrLength(szReturn));
endwhile;
return szReturn;
end;
Thanks
Sachin Pawar
prototype STRING TrimStart(STRING, STRING);
///
///Removes all occcurences of the trim string at the start of original
/// string.
///
///
function STRING TrimStart(szString, szTrim)
STRING szReturn;
begin
szReturn = szString;
while(StrFind(szReturn,szTrim) = 0)
StrSub(szReturn, szReturn, StrLength(szTrim), StrLength(szReturn));
endwhile;
return szReturn;
end;
Thanks
Sachin Pawar
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 11, 2008
07:47 AM
🙂 Function to remove occurences of certain string from end of provided string.
prototype STRING TrimEnd(STRING, STRING);
///
///Removes all occcurences of the trim string at the end of original
/// string.
///
///
function STRING TrimEnd(szString, szTrim)
STRING szReturn;
INT ivStartIndex;
INT ivTrimLength;
begin
szReturn = szString;
ivTrimLength = StrLength(szTrim);
ivStartIndex = StrLength(szReturn) - ivTrimLength;
while(StrFindEx(szReturn,szTrim, ivStartIndex) > 0)
StrReplace(szReturn, szTrim,"",ivStartIndex);
ivStartIndex = StrLength(szReturn) - ivTrimLength;
endwhile;
return szReturn;
end;
prototype STRING TrimEnd(STRING, STRING);
///
///Removes all occcurences of the trim string at the end of original
/// string.
///
///
function STRING TrimEnd(szString, szTrim)
STRING szReturn;
INT ivStartIndex;
INT ivTrimLength;
begin
szReturn = szString;
ivTrimLength = StrLength(szTrim);
ivStartIndex = StrLength(szReturn) - ivTrimLength;
while(StrFindEx(szReturn,szTrim, ivStartIndex) > 0)
StrReplace(szReturn, szTrim,"",ivStartIndex);
ivStartIndex = StrLength(szReturn) - ivTrimLength;
endwhile;
return szReturn;
end;
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)