![]() |
how to split string?
Hi!
Here is my question: I have this string line:" Google search=http://www.google.com " or this:" Yahoo page=http://www.yahoo.com " (symbols "=" and "http" are in everywhere line). I need to split string line to get this: One string - "Google search" and other string - "http://www.google.com". Please help me :wink: :!: Thank`s! |
Re: how to split string?
Hey there, how about that?
Delphi-Quellcode:
Should work :)
ItemName := Copy(ItemString, 1, Pos('=', ItemString)-1);
ItemURL := Copy(ItemString, Pos('=', ItemString)+1, Length(ItemString)); edit: oh darn, forgot the ':'s :mrgreen: |
Re: how to split string?
Another possibility is the usage of the Values[] and Names[] properties of a TString descendant (e.g. TStringList).
|
Re: how to split string?
Thank`s! It works great!
|
Re: how to split string?
Hello again! :-D
I have one new question: I have ini file with section "favorites", wherein are many lines like this one: "Google search=http://www.google.com". I need to add this section to the ListBox1, but there must be only names ("Google search") and on click this name webbrowser must to navigate "http://www.google.com" (program must to remember name`s url). |
Re: how to split string?
Hello
Zitat:
|
Re: how to split string?
Hello alpha1,
mind your wording. This seems to be more of a zoom-in question. Make sure you use TMemIniFile instead of TIniFile. Read the Names from your link section using the method ReadSection(). Once an item is clicked you can fetch the hyperlink on-demand by using ReadString(). Regards, marabu |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:40 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz