AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

how to split string?

Ein Thema von alpha1 · begonnen am 6. Mai 2006 · letzter Beitrag vom 9. Mai 2006
Antwort Antwort
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#1

how to split string?

  Alt 6. Mai 2006, 16:13
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
Thank`s!
  Mit Zitat antworten Zitat
Dax
(Gast)

n/a Beiträge
 
#2

Re: how to split string?

  Alt 6. Mai 2006, 16:16
Hey there, how about that?

Delphi-Quellcode:
ItemName := Copy(ItemString, 1, Pos('=', ItemString)-1);
ItemURL := Copy(ItemString, Pos('=', ItemString)+1, Length(ItemString));
Should work

edit: oh darn, forgot the ':'s
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#3

Re: how to split string?

  Alt 6. Mai 2006, 16:23
Another possibility is the usage of the Values[] and Names[] properties of a TString descendant (e.g. TStringList).
  Mit Zitat antworten Zitat
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#4

Re: how to split string?

  Alt 6. Mai 2006, 16:53
Thank`s! It works great!
  Mit Zitat antworten Zitat
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#5

Re: how to split string?

  Alt 9. Mai 2006, 16:08
Hello again!
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).
  Mit Zitat antworten Zitat
Benutzerbild von Matze
Matze
(Co-Admin)

Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
 
Turbo Delphi für Win32
 
#6

Re: how to split string?

  Alt 9. Mai 2006, 16:14
Hello

Zitat von alpha1:
I have one new question [..]
Please create a new thread for each question. The reason is that it's easier to find a solution for a ploblem with the search function when only one question is asked in one thread. Thank you.
  Mit Zitat antworten Zitat
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#7

Re: how to split string?

  Alt 9. Mai 2006, 16:24
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
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:56 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz