Mattiaf Active Member Licensed User Nov 14, 2022 #1 Hi, How can I split the following string B4X: Expand Collapse Copy -CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA in order to get only B4X: Expand Collapse Copy -CA100- ? I'm trying with B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String strSplit=Regex.Split("-",strBeforeSplit) Msgbox(strSplit(0) but it doesn't work.. any idea? thanks
Hi, How can I split the following string B4X: Expand Collapse Copy -CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA in order to get only B4X: Expand Collapse Copy -CA100- ? I'm trying with B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String strSplit=Regex.Split("-",strBeforeSplit) Msgbox(strSplit(0) but it doesn't work.. any idea? thanks
Solution DonManfred Nov 14, 2022 CA100 is the SECOND value! Regex starts at the first - to split. means: 1st item is an empty string, 2nd Item CA100, 3rd Item ISTITUTO PERTINI VIA CARPACCIO N° 18 A and 4th item N° 1 CHIAVE MECCANICA B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String = Regex.Split("-",strBeforeSplit) Log($"AfterAplit: ${strSplit(1)}"$)
CA100 is the SECOND value! Regex starts at the first - to split. means: 1st item is an empty string, 2nd Item CA100, 3rd Item ISTITUTO PERTINI VIA CARPACCIO N° 18 A and 4th item N° 1 CHIAVE MECCANICA B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String = Regex.Split("-",strBeforeSplit) Log($"AfterAplit: ${strSplit(1)}"$)
DonManfred Expert Licensed User Longtime User Nov 14, 2022 #2 CA100 is the SECOND value! Regex starts at the first - to split. means: 1st item is an empty string, 2nd Item CA100, 3rd Item ISTITUTO PERTINI VIA CARPACCIO N° 18 A and 4th item N° 1 CHIAVE MECCANICA B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String = Regex.Split("-",strBeforeSplit) Log($"AfterAplit: ${strSplit(1)}"$) Upvote 1 Solution
CA100 is the SECOND value! Regex starts at the first - to split. means: 1st item is an empty string, 2nd Item CA100, 3rd Item ISTITUTO PERTINI VIA CARPACCIO N° 18 A and 4th item N° 1 CHIAVE MECCANICA B4X: Expand Collapse Copy Dim strBeforeSplit As String strBeforeSplit="-CA100-ISTITUTO PERTINI VIA CARPACCIO N° 18 A - N° 1 CHIAVE MECCANICA" Dim strSplit() As String = Regex.Split("-",strBeforeSplit) Log($"AfterAplit: ${strSplit(1)}"$)