文字列のリバース <TOP>
入力した文字列を逆に表示します。
「どういう使い方があるの?」って言うのは無しで・・
'================================================================ '= 文字列のリバース
'= (ReverseString.bas) '================================================================ #include "Windows.bi" Var Shared Text1 As Object Var Shared Edit1 As Object Text1.Attach GetDlgItem("Text1") : Text1.SetFontSize 14 Edit1.Attach GetDlgItem("Edit1") : Edit1.SetFontSize 14 '================================================================ '= '================================================================ Declare Function RevStr(sString As String) As String Function RevStr(sString As String) As String Var i As Long Var nLen As Long Var sBuffer As String nLen = Len(sString) For i = nLen To 1 step -1 sBuffer = sBuffer & KMid$(sString, i, 1) Next i RevStr = sBuffer End Function '================================================================ '= '================================================================ Declare Sub Button1_on edecl () Sub Button1_on() Var MyStr As String MyStr = Edit1.GetWindowText Text1.SetWindowText RevStr(MyStr) End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End