Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Replace String?

[es] :: Visual Basic 6 :: Replace String?

[ Pregleda: 2530 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

-wx-
Beograd

Član broj: 1766
Poruke: 34
*.tehnicom.net

Jabber: wx@jabber.com
ICQ: 166638118


Profil

icon Replace String?05.09.2003. u 14:14 - pre 251 meseci
Da li je moguće utvrditi kraj nekog stringa? Nešto slično kao EOF samo za stringove. Ovaj deo programa bi trebao da pretraži ceo string (frmMain.rtfQuickEdit.Text) i da zameni txtSearch.Text u stringu sa txtReplace.Text.

Code:

Private Sub cmdReplace_Click()
    Dim Position As Long
    Position = 0
While Not EndOfString
    Position = frmMain.rtfQuickEdit.Find(txtSearch, Position, Len(frmMain.rtfQuickEdit))
    With frmMain.rtfQuickEdit
        .SelStart = Position
        .SelLenght = Len(txtSearch)
        .SelText = Replace(frmMain.rtfQuickEdit, txtSearch, txtReplace, , , vbTextCompare)
        .SetFocus
    End With
Loop
End Sub

'This is a unique time in our history, in the history of any civilization, it's the moment of the acquisition of technology, that's the moment when contact becomes possible'
 
Odgovor na temu

mladenovicz
Zeljko Mladenovic
Xoran Technologies, Inc., Ann Arbor, MI,
USA / Software Engineer
Ann Arbor, MI, USA

Član broj: 6598
Poruke: 2065
*.yubc.net

Jabber: mladenovicz@elitesecurity.org
ICQ: 95144142
Sajt: yubc.net/~mz


Profil

icon Re: Replace String?05.09.2003. u 14:29 - pre 251 meseci
Replace bi trebao da ti zameni sva pojavljivanja, ukoliko izostavis parametar count -
znaci ne moras da ides kroz string. Znaci ovo bi trebalo da odradi posao:

Code:

frmMain.rtfQuickEdit=Replace(frmMain.rtfQuickEdit, txtSearch, txtReplace) 


Ako vec hoces da ides kroz string i imas Position promenljivu, onda ti je EndOfString = (Position = Len(str))
 
Odgovor na temu

-wx-
Beograd

Član broj: 1766
Poruke: 34
*.tehnicom.net

Jabber: wx@jabber.com
ICQ: 166638118


Profil

icon Re: Replace String?05.09.2003. u 14:52 - pre 251 meseci
Hvala na odgovoru, probao sam i radi.
'This is a unique time in our history, in the history of any civilization, it's the moment of the acquisition of technology, that's the moment when contact becomes possible'
 
Odgovor na temu

[es] :: Visual Basic 6 :: Replace String?

[ Pregleda: 2530 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.