จะเขียน function เช็คสตริงไงครับ
เช่น ได้รับ สตริงชุด1 แล้ว ถ้าตัวแรกเป็นตัว m ให้return สตริงที่ต่อจากm
ตัวอย่าง ได้รับ m11563 ให้รีเทรน 11563 แต่ถ้าไม่ได้นำด้วย m ก็ไม่ต้องรีเทรนค่า
ขอบคุณล่วงหน้าครับ
Printable View
จะเขียน function เช็คสตริงไงครับ
เช่น ได้รับ สตริงชุด1 แล้ว ถ้าตัวแรกเป็นตัว m ให้return สตริงที่ต่อจากm
ตัวอย่าง ได้รับ m11563 ให้รีเทรน 11563 แต่ถ้าไม่ได้นำด้วย m ก็ไม่ต้องรีเทรนค่า
ขอบคุณล่วงหน้าครับ
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...
ขั้นแรกต้องเช็คก่อนว่าตัวแรกเป็น m หรือไม่
Dim CutStr As String ' เอาไว้รับค่าตัวแรก
CutStr = left$(text1.text,1) 'ตัดคำเอาตัวแรกโดยtext1.text คือสตริงที่เอามาเช็ค
จะได้แล้วว่าตัวแรกเป็นตัวอะไรก็เอามาเช็ค if else