Are there easy codes equivalent to Substring( ) in

Results 1 to 2 of 2

Thread: Are there easy codes equivalent to Substring( ) in

  1. #1
    daniel Guest

    Default Are there easy codes equivalent to Substring( ) in

    I am a ASP newbie who needs to convert my Perl codes to ASP.<BR>So far I haven&#039t found a string function to replace/insert character(s) in a string based on the character position, like the SUBSTRING function in Perl. For example, I can in Perl:<BR><BR>$processed = "I need an membershi"<BR>$reconst = "xM3aaayIp" <BR># x&#039s ASCII value indicate the char position in $processed , <BR># M is action for Multiple Insertion, 3 is the number of<BR># Multiple Insert, which is aaa; y&#039s ASCII value indicate the position of $processed where the next action is to be performed,<BR># I is single char insertion, b is the char to be inserted<BR># before the ORD("y") position<BR><BR>.... (pseudo code)<BR>If "M", then the action is Multiple Insertion<BR>substring ($processed, ORD("x"), 0) = "aaa" <BR><BR>If "I", then action will be Single Insertion<BR>substring ($processed, ORD ("y"), 0) = "p"<BR><BR>Print $substring out and it will be <BR>"I need an aaa membership"<BR><BR>Instead of breaking $processed into an arrary of individual characters and having to loop and count and update array indexes to accomodate inserted or deleted characters, are there simpler ways to do it?<BR><BR>Appreciate it much!<BR><BR>daniel

  2. #2
    Michal m Guest

    Default RE: Are there easy codes equivalent to Substring(

    Hi daniel,<BR>Look into the following function<BR><BR>Instr - to find a character in a string<BR>Mid,Right,Left - roughly equivalent to your substring<BR>Split-Splits a string using a delimiter into an array<BR><BR><BR>has all the reference information.<BR>Hope this helps,<BR>MichaL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts