Jump to content

Recommended Posts

Posted (edited)

$days = StringSplit("Sun,Mon,Tue,Wed,Thu,Fri,Sat", ",")

;$days[1] contains "Sun" ... $days[7] contains "Sat"

flag = 1, entire delimiter string is needed to mark the split

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted

soooo....

$days[3] = "$" & $days[3]

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Posted

$days[3] = "$" & $days[3]

Uh what ?

$obj changes it can be

$obj = "Hello $Me" 
$obj = "Hello $Doll"
 $obj = "Hello"

When its just "Hello" it crashes with stringsplit

Posted (edited)

If $obj = "Hello $Me" or "Hello $Whatever" already, why does that string need to be StringSplit out of itself and set to something else? Why not just use $obj, again?

Edit: Does $obj always but only sometimes have "Hello"? If the string <> "Hello", or if it's more than 5 chars, or some other thing.., then put a StringSplit to it..

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

Oh, I thought you wanted the "$" back on after the stringsplit.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Posted

Well if the $obj is not only "hello" if its "hello $mia" i need to get into into to seperate strings. i need the "mia" in one and "hello" in one, the "hello" can also change u see.

Posted

StringRegExp might be the easiest way then.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Posted

Can i use StringRegExp to get all data before " $" and then use it again to get everything after " $" and if there is no " $" it shud just return something empty right ?

Posted

Does this work in all cases the way you need?

#include <Array.au3>
Local $str[6] = ["Hello$World!", "Hello$", "Hello", "$World!", "$", ""], $ret
For $i = 0 To UBound($str) - 1
    $ret = StringRegExp($str[$i], "([^$]*)\$?([^$]*)?", 1)
    _ArrayDisplay($ret, "Split of '" & $str[$i] & "'")
Next

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted (edited)

Ok that looks good so far,

so if its

$days = StringSplit("Hey man $aha"," {:content:}quot;)
MsgBox(0,"",$days[1]) MsgBox(0,"",$days[3])

It works, but the problem is it can end up without the " $")

$days = StringSplit("Hey girl", " $") 
MsgBox(0,"",$days[1]) MsgBox(0,"",$days[3])

And that wont let me run it.

For future reference, I direct your attention to the parameters of StringSplit in the help file.

You are using "0", the default flag parameter, which is wrong, because you are using more than one character as the delimiter to mark the split/s in the string.

#include <Array.au3>
$days = StringSplit("Hey man $aha", " $", 3)
_ArrayDisplay($days)

Edit: Change the the automatic change of " $" to " {:content:}quot; back to " $"

Edit2: And again.

Edited by Malkey
Posted (edited)

Also, for your future reference, if you are using more than one character(say "xy") with default flag, string will be splitted by the delimeter "x" OR "y".

Example:

#include <array.au3>
$a = "111x222y333"
$b = StringSplit($a,"xy")
_ArrayDisplay($b)
Edited by Mison

Hi ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...