Results 1 to 3 of 3

Thread: ถามเซียน VB 6 หน่อยครับ

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    1


    จะเขียน function เช็คสตริงไงครับ

    เช่น ได้รับ สตริงชุด1 แล้ว ถ้าตัวแรกเป็นตัว m ให้return สตริงที่ต่อจากm

    ตัวอย่าง ได้รับ m11563 ให้รีเทรน 11563 แต่ถ้าไม่ได้นำด้วย m ก็ไม่ต้องรีเทรนค่า


    ขอบคุณล่วงหน้าครับ
    [b][SIZE=2][color=#FF6600]+++++++++++++++นี้แหละวิถีชีวิต ของผม++++++++++++[/color][/SIZE][/b]

  2. #2
    Senior Member
    Join Date
    Sep 2007
    Location
    Laos
    Posts
    192


    Easy algorithm is....

    1. Using Substring() function in order to get the character or string that you want....

    2. Test whether the character that you get is "m" or not. If true return the rest of string using Substring function, else return blank.

    P.S. Don't want to write the code for you, cause it's not good for you...

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    8


    ขั้นแรกต้องเช็คก่อนว่าตัวแรกเป็น m หรือไม่
    Dim CutStr As String ' เอาไว้รับค่าตัวแรก
    CutStr = left$(text1.text,1) 'ตัดคำเอาตัวแรกโดยtext1.text คือสตริงที่เอามาเช็ค
    จะได้แล้วว่าตัวแรกเป็นตัวอะไรก็เอามาเช็ค if else

Similar Threads

  1. Replies: 1
    Last Post: 25-09-2007, 03:43 PM
  2. Replies: 1
    Last Post: 17-08-2007, 05:18 PM
  3. Replies: 0
    Last Post: 03-08-2007, 08:17 PM
  4. Replies: 4
    Last Post: 28-07-2007, 07:46 PM
  5. Replies: 0
    Last Post: 01-01-1970, 07:00 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •