Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of LTjake (4001)

Tuesday August 26, 2003
02:59 PM

Things I hate about VBScript - part 36,431

[ #14335 ]


Please, someone, give me a good reason why Split( str, "" ) returns str?! I want to be able to do something like:

my @chars = split(//, $str);

But noooooooooooooo.....

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It has been a very long time since I tried my hand at VBScript, I'm still healing. How about: Split( str, "|" )?

    Casey West
  • ... with an empty expression string (would produce an array of all characters in the string in perl) will NOT produce an array but return the string as if cut with space as the expression.

    You might want to do this by hand... using a foreach loop and Left or something abominable to get each character of the string.

    VBs code for split uses InStr and InStrRev (sp?) searching for the pattern and Mid to cut out the string.

    I once parsed HTML brackets (a long time ago) for equality of said bracket numbers...

    • Am I missing something here?

      ~ % perl -e 'print join("*",split "","something here"),"\n"'
      s*o*m*e*t*h*i*n*g* *h*e*r*e

      Or if you prefer...

      ~ % perl -e 'print join("*",split //,"something here"),"\n"'
      s*o*m*e*t*h*i*n*g* *h*e*r*e
    • To make an array of chars i did this:

      Dim arrInput
      ReDim arrInput( Len( strInput ) - 1 )

      For intTemp = 1 To Len( strInput )
          arrInput( intTemp - 1 ) = Mid( strInput, intTemp, 1 )

      Sucky, i know, but atleast doing:

      strInput = Join( arrInput, "" )

      works to get the string back! :)