Jump to content

Text'en Veri Değiştirme


korasoglu
 Share

Recommended Posts

Arkadaşlar kintaronun bul ve değiştir diye bir çalışması vardı. Bu çalışmada 1 tane yazı değişimi yapılabiliyor mesela bunu 15 tane olsa nasıl yapabilirim.

Kintaronun kullandığı kod şu


[codeBOX]sYol = Input.GetText("yol")
sMetin1 = Input.GetText("Input1")
sMetin2 = Input.GetText("Input2")
if sYol ~= "" and sMetin1 ~= "" and sMetin2 ~= "" then
sDosya = TextFile.ReadToString(sYol)
nAra = String.Find(sDosya, sMetin1, 1, true)
if nAra ~= -1 then
sDegisen = String.Replace(sDosya, sMetin1, sMetin2, true)
TextFile.WriteFromString(sYol, sDegisen, false)
Dialog.TimedMessage("OK", "Değiştirme başarılı!", 2000, MB_ICONINFORMATION)
else
Dialog.Message("Hata", "Aradığınız kelime mevcut değil", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
end
else
Dialog.Message("Hata", "Tüm alanları doldurun", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
end[/codeBOX]
------------------------------------------------------------------------------------------------------------------------------------------------------------

Birde Html kod ekliyemiyorum yardımınızı bekliyorum

Birdiye işaretlediğim yerleri ardışık olarak "2,3,4..." değişkenden alacak ve web sayfasında gösterecek. Ne olur çalışma örneği demeyin zaten örnek hazırlasam sizlere bunu yazmazdım anlayışınız için şimdiden teşekkür ederim
[codebox]
<html>
<body>


<table border="1" width="100%" id="table2">
<tr>
<td width="157"><font face="Arial" size="2">ADI</font></td>
<td><font face="Arial" size="2">1-----</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">SOYADI</font></td>
<td><font face="Arial" size="2">2</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">GÖREVİ</font></td>
<td><font face="Arial" size="2">3</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">GÖREV YERİ</font></td>
<td><font face="Arial" size="2">4</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">TC NO</font></td>
<td><font face="Arial" size="2">5</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">ADRES</font></td>
<td><font face="Arial" size="2">6</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">CEP TEL 1 </font></td>
<td><font face="Arial" size="2">7</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">CEP TEL 2</font></td>
<td><font face="Arial" size="2">8</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">EV TEL</font></td>
<td><font face="Arial" size="2">9</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">MAİL 1</font></td>
<td><font face="Arial" size="2">10</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">MAİL 2</font></td>
<td><font face="Arial" size="2">11</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2">KAN GRUBU</font></td>
<td><font face="Arial" size="2">12</font></td>
</tr>
<tr>
<td width="157"><font face="Arial" size="2"><br>
NOT<br>
&nbsp;</font></td>
<td><font face="Arial" size="2">13</font></td>
</tr>
</table>

</body>

</html>
[/codebox]
Link to comment
Share on other sites

  • Editor

sYol = Input.GetText("yol")
sMetin1 = Input.GetText("Input1")
sMetin2 = Input.GetText("Input2")
if sYol ~= "" and sMetin1 ~= "" and sMetin2 ~= "" then
sDosya = TextFile.ReadToString(sYol)
nAra = String.Find(sDosya, sMetin1, 1, true)
if nAra ~= -1 then
[color="#FF0000"] sDegisen = String.Replace(sDosya, sMetin1, sMetin2, true)[/color]
[color="#0000FF"]sDegisen = String.Replace(sDegisen, bulunacak yazi,değiştirilecekyazi, true)[/color][color="#9ACD32"]--Burayı bu şekilde istediğin gibi çogaltabilirsin.[/color]
TextFile.WriteFromString(sYol, sDegisen, false)
Dialog.TimedMessage("OK", "Değiştirme başarılı!", 2000, MB_ICONINFORMATION)
else
Dialog.Message("Hata", "Aradığınız kelime mevcut değil", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
end
else
Dialog.Message("Hata", "Tüm alanları doldurun", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
end

Link to comment
Share on other sites

Ben anlatamamışım diyelim 15 tane Input var 15 tane Inputtaki texti 15 değişkenle değiştireceğiz. Verdiğinizi denemedim cevabınızı okuyunca böyle anladım. Bu örnekte bir link ve bir dosya var Input1 girilen değeri linkte arıyor bulursa Input2 deki değerle değiştiriyor mantık bu ama bunu daha çok değişiikliği nasıl yapabilirim.

Link to comment
Share on other sites

Daha önceden yazmış olduğum kodu fonksiyon haline çevirdim.

[quote]bulDegistir(dosya_yolu, aranan_kelime, degistirilecek_kelime)[/quote]

seklinde istediğiniz kadar kullanabilirsiniz.

:download1:

[code]http://www.mediafire.com/?736ev1eb4rrona1[/code]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...