aldis Posted June 4, 2007 Report Share Posted June 4, 2007 Zinu ka si ganjau ir loti vnk.. lieta! Bet tomer, ja kads ludzams varetu pateikt... Ja man ievadaa ir sads taksts- es esmucilveks un buusu cilveks vienmer! Kaa es so tekstu varetu iepakot vienaa liinijaa.. lai izskatitos sadi!? es esmu cilveks un buusu cilveks vienmer! Cik saprotu, jasakopo visas rindas kopaa.. un enteri japarvedo par atstarpeem!? vai kaa!? Link to comment Share on other sites More sharing options...
andrisp Posted June 4, 2007 Report Share Posted June 4, 2007 Jā, enteri par atstarpēm. php.net/str_replace Link to comment Share on other sites More sharing options...
aldis Posted June 4, 2007 Author Report Share Posted June 4, 2007 par str replace man ienaca prata.. bet ka apzime enteru!? k-kaa /n vai k-kaa taa!? Link to comment Share on other sites More sharing options...
bubu Posted June 4, 2007 Report Share Posted June 4, 2007 "\n" http://lv2.php.net/string#language.types.s...g.syntax.double Link to comment Share on other sites More sharing options...
cucumber Posted June 4, 2007 Report Share Posted June 4, 2007 chr() ar var salidzinat, isti neatceros bet enteram bija 23 Link to comment Share on other sites More sharing options...
bubu Posted June 4, 2007 Report Share Posted June 4, 2007 Un ko tu tur salīdzināsi cucumber? Katru stringa simbolu? Kam tad tavuprāt ir str_replace funkcija paredzēta. Nezinu, kas ir 23, jo \n ir 0x0A=10. Link to comment Share on other sites More sharing options...
Exzo Posted June 5, 2007 Report Share Posted June 5, 2007 $replace_order = array("\r\n", "\n", "\r"); // tieši šadā secībā!!! str_replace($replace_order, ' ', $text)); Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 5, 2007 Report Share Posted June 5, 2007 $replace_order = array("\r\n", "\n", "\r"); kam atkartoties? "\r\n", "\n", "\r" ir gandriiz vienaads ar "\n", "\r" abos gadijumos visi \n un \r tiks parveidoti par atstarpi... Link to comment Share on other sites More sharing options...
andrisp Posted June 5, 2007 Report Share Posted June 5, 2007 Grey_Wolf, pats jau saki "gandriiz vienaads". Taakaa Exzo variants ir vispreciizaakais. Shis piemeers ir arii manuaalii. Link to comment Share on other sites More sharing options...
Exzo Posted June 5, 2007 Report Share Posted June 5, 2007 Tāpēc ka Windoze, Nix un Maki by default (kur nu vēl dažāda browseri un cita zoftwāre) dažādi apzīmē linefeed. Newline Dažiem skriptu editoriem ir pat iespēja to definēt... Link to comment Share on other sites More sharing options...
Exzo Posted June 5, 2007 Report Share Posted June 5, 2007 Kaut vai pamēģini JavaScriptu funkcijai iebarot daudzrindu teksta paramteru ar nostripotiem "/n" un atstātiem "/r", ja pareizi atceros tad FF textarea wrapoja ar "/n/r" Link to comment Share on other sites More sharing options...
bubu Posted June 5, 2007 Report Share Posted June 5, 2007 \r vispār ir reti vairs kur sastopams - tikai vecajos MacOS (<10 versijas). Jaunajos MacOSX tagad ir linuxa newlains lietots - \n. Tāpēc aizvietojot tikai \n ar to kas vajadzīgs tiks aizvietots gan Windowziskais, gan MacOSX/Linuxiskais newlains. Link to comment Share on other sites More sharing options...
Recommended Posts