Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 2 odgovora
  • 3.439 pregleda

Najnovija ↓

Replace String? 05.09.2003. u 15:14 · pre 281 mesec #1
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
Potpis
'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'
Re: Replace String? 05.09.2003. u 15:29 · pre 281 mesec #2
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))
Potpis
Blue Man Group
Re: Replace String? 05.09.2003. u 15:52 · pre 281 mesec #3
Hvala na odgovoru, probao sam i radi.
Potpis
'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'
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme