Veröffentlicht 31. Juli 200322 j Hallo! Ich suche ein Pendant zu der CString Funktion 'SetAt' in PHP. Gibt es sowas? Hier die Beschreibung des CString SetAt: CString::SetAt This method overwrites a single character specified by an index number. SetAt will not enlarge the string if the index exceeds the bounds of the existing string. void SetAt( int nIndex, TCHAR ch ); Parameters nIndex Specifies the zero-based index of the character in the CString object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength. The Debug version of the Microsoft Foundation Class Library validates the bounds of nIndex; the Release version does not. ch Specifies the character to insert. [/php] Bine
31. Juli 200322 j string substr_replace (string string, string replacement, int start [, int length])
2. August 200322 j Hallo Woodstock! In PHP (genau wie in C) sind Strings nichts anderes als Zeichenarrays, daher kannst du einfach mit $text[4] z.B. auf das fünfte Zeichen (Index beginnt mit null!) zugreifen.
5. August 200322 j So einfach ist das leider nicht. Ich habe Funktionen die teilweise rekursiv sind - und da ist das schon ein wenig komplizierter. Aber die Funktion die ulluoink mir genannt hat funktioniert einwandfrei. Programm ist so gut wie fertig - ich mache nur noch die Feinheiten! Bine
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.