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

Replace String?

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

[ Pregleda: 1188 | Odgovora: 2 ]

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

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'
05.09.2003. u 14:14 

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

Moderator
Član broj: 6598
Poruke: 2064
*.yubc.net

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


Profil

icon Re: Replace String?05.09.2003. u 14:29
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))
05.09.2003. u 14:29 

-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
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'
05.09.2003. u 14:52 

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

[ Pregleda: 1188 | Odgovora: 2 ]

Postavi temu Odgovori

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