Address split into streetname and number
- FlowHeater-Team
- Topic Author
- Offline
- Admin
Less
More
6 years 2 weeks ago #3489
by FlowHeater-Team
Best wishes
Robert Stark
Address split into streetname and number - Post(3489) was created by FlowHeater-Team
Hey guys,
What i need to do is write from an Access database to a MySql database. my issue is in the address line. i need to split the streetname and number, but there is no clear indication of where i can split the address.
For example:
Schmiedestr. 13 - 15
Im Gewerbepark 26-30
Küferstr. 10 a
Schützenhofstr. 113 a
I can't find a clear place tosplit it and i can find a way to filter it out. Maybe you guys have seen this issue before and know how to bypass it.
Thanks in advance guys!
Kind regards,
Jonas
Request received via email
What i need to do is write from an Access database to a MySql database. my issue is in the address line. i need to split the streetname and number, but there is no clear indication of where i can split the address.
For example:
Schmiedestr. 13 - 15
Im Gewerbepark 26-30
Küferstr. 10 a
Schützenhofstr. 113 a
I can't find a clear place tosplit it and i can find a way to filter it out. Maybe you guys have seen this issue before and know how to bypass it.
Thanks in advance guys!
Kind regards,
Jonas
Request received via email
Best wishes
Robert Stark
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Topic Author
- Offline
- Admin
6 years 2 weeks ago #3490
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic Address split into streetname and number - Post(3490)
Hi Jonas,
For this special topic, you need the help of the .NET Script Heater and thelittle script below. The script search for the first number position in the street name. If a number was found the script adds a delimiter in the street name, for example -#-
Afterwards you can split this with the delimiter extended street name withthe String Split Heater into two separate parts. You´ll find an example
attached.
C# script
For this special topic, you need the help of the .NET Script Heater and thelittle script below. The script search for the first number position in the street name. If a number was found the script adds a delimiter in the street name, for example -#-
Afterwards you can split this with the delimiter extended street name withthe String Split Heater into two separate parts. You´ll find an example
attached.
C# script
Code:
string delimiter = "-#-";
public object DoWork()
{
if (InValues.Length != 1)
throw new Exception("one input parameter expected!");
// access the first input parameter
string val = (string)InValues[0].GetString();
// find the position of the first numeric character
int pos = val.IndexOfAny(new char [] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'});
if (pos > 0)
{
string street = val.Substring(0, pos);
string number = val.Substring(pos);
val = street + delimiter + number;
}
else
val += delimiter;
return val;
}
Best wishes
Robert Stark
Attachments:
Please Log in or Create an account to join the conversation.
- Jonas Boudewijns
- Offline
- User
Less
More
- Posts: 3
6 years 2 weeks ago #3491
by Jonas Boudewijns
Replied by Jonas Boudewijns on topic Address split into streetname and number - Post(3491)
Works like a charm, thank you!
Please Log in or Create an account to join the conversation.
Time to create page: 0.262 seconds