⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 回文字串.frm

📁 Visual Basic课程举例1 有很好的例题
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "检查字符串是否是回文"
   ClientHeight    =   2475
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6570
   LinkTopic       =   "Form1"
   ScaleHeight     =   2475
   ScaleWidth      =   6570
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   300
      TabIndex        =   1
      Top             =   420
      Width           =   5895
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始检查"
      Height          =   435
      Left            =   2220
      TabIndex        =   0
      Top             =   1620
      Width           =   1575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim A$, B$

A$ = Text1.Text '取出欲判断字符串
B$ = A$         '做一个副本
L = Len(A$)     '求出长度

For I = 1 To L  '在B中做出A的反串
    Mid(B$, L - I + 1, 1) = Mid(A$, I, 1)
Next I

If A$ = B$ Then '如果正反串一样则是回文
    MsgBox "字符串""" & A$ & """是回文"
Else
    MsgBox "字符串""" & A$ & """不是回文"
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -