Wednesday, January 11, 2012

Vb.net String.Split(vbCrLf) problem

You got a text that you want to split in rows at CrLf so you code the following:

Dim MyText as String = "bla bla" + vbCrLf + "more blabla" + vbCrLf +"stop blabla"
dim s() as String = MyText.split(vbCrLf)

You expect to get s(1)="more blabla" but you will get CrLf + 'more blabla'

The text got split BUT you also got a CrLf in the splits.
To avoid this Replace vbCrLf with
Dim CrLf() as char = {vbCr,vbLf}
So the split commando will be
dim s() as String = MyText.split(CrLf)
and now s(1) will be 'more blabla'

OR

Do as 'Anonymous' pointed out in the comments:
 Dim s() As String = MyText.Split(New String() {vbCrLf}, StringSplitOptions.None)

MySQL to MariaDB

 Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...