ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

³B²zSTRING®É¹J¨ì§xÃø

¦^´_ 3# ¤p«L«È
Sorry!!¨S¬Ý²M·¡§Aªº¥Î·N
  1. Function TheWord(Mystr As String, dot As String, i As Integer) As String
  2. Dim Ay()
  3. ar = Split(Mystr, dot)
  4. For Each a In ar
  5.   If a <> "" Then
  6.   ReDim Preserve Ay(s)
  7.   Ay(s) = a
  8.   s = s + 1
  9.   End If
  10. Next
  11. TheWord = Ay(i - 1)
  12. End Function


  13. Sub nn()
  14. Dim i As Integer
  15. For i = 1 To 4
  16.   MsgBox TheWord("Now  is   the time", " ", i)
  17. Next
  18. End Sub
½Æ»s¥N½X

TOP

ÁÂÁ¤j¤j¡AÁöµM§A¼gªº¥N½X¸ò§Úªº­ì·N¦³ÂI¤£¦P¡A¦]¬°§Úªº¥Øªº¬O©â¨ú¬Y¤@­Óµü¡A¨Ò¦p¡GWORD("§Ú ¬O  ¤@­Ó      ¨k   ¥Í", 3) = ¤@­Ó¡A¸òMID¦³ÂI¦ü¡A¦ý§Ú¬O¥Hµü²Õ¬°°ò¦¡C
§Ú§â§Aªº²z©À¥[¤J¡A¦¨¥\»s¦¨¤FWORD³o­ÓFUNCTION¤F¡C

§Ú¤§«e¤]¸Õ¹L¥Î"SPLIT"³o­Ó¥\¯à¡A¦ý§Ú¤@ª½¥H¬°SPLITªº¥Îªk¬O§â¦r¦ê©î¶}¡A¦A©ñ¤J¦C°}¤¤¡A¨Ò¦p¡GA()=SPLIT(STRING, " ")
§Ú§âSPLIT©ñ¦b¤W­±ªºCODE®É¡Aµo²{¤F¦³³¡¥÷ªº¦C°}¬OªÅªº¡A·Q¤£¨ì­ì¨Ó¥i¥H¥ÎREDIM PRESERVE§R¥h¡A¤Ó§Q®`¤F¡A¤S¦h¾Ç¤@­Ó¤èªk¡AÁÂÁ¡C

TOP

¦^´_ 1# ¤p«L«È
  1. Function TRIM_Str(Mystr As String) As String
  2. Dim Ay()
  3. ar = Split(Mystr, " ")
  4. For Each a In ar
  5.   If a <> "" Then
  6.   ReDim Preserve Ay(s)
  7.   Ay(s) = a
  8.   s = s + 1
  9.   End If
  10. Next
  11. TRIM_Str = Join(Ay, " ")
  12. End Function


  13. Sub nn()
  14. MsgBox TRIM_Str("Now  is   the time")
  15. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD