กระทู้เก่าบอร์ด อ.Yeadram
        
           1,224   3		  
          
					  
		    URL.หัวข้อ / 
		    URL
        
        ขอฟังก์ชั่นค้นหาคำในตัวแปรที่ต้องการ      
    
      strvalue = "ABCDEFG"
อยากจะค้นหาคำว่า "A" มีอยู่ในตัวแปร strvalue หรือเปล่าต้องใช้ ฟังก์ชั่นอะไรครับ
เท่าที่หาเจอคือใช้ instr() ครับ แต่ดูแล้วไม่น่าจะใช่
    
    
  อยากจะค้นหาคำว่า "A" มีอยู่ในตัวแปร strvalue หรือเปล่าต้องใช้ ฟังก์ชั่นอะไรครับ
เท่าที่หาเจอคือใช้ instr() ครับ แต่ดูแล้วไม่น่าจะใช่
				3 Reply in this Topic. Dispaly 1  pages and you are on page number 1 
				
        
    2 @R06891    
        
  
      ลองแล้วครับ แต่นึกว่ามี function อื่นๆที่ดีกว่าครับ ขอบคุณมากครับ    
    
  
        
    3 @R06897    
        
    
      ฟังก์ชันนี้ทำงานช้า ว่างั้น    
    
  
      Time: 0.0667s
    
      
		
1. ไม่ได้ลองใช้
2. ไม่รู้ว่าจะใช้ยังไง
ถ้าเป็นอย่างข้อ 1, 2 ลองนี่เลย
Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP" ' String to search in.
SearchChar = "P" ' Search for "P".
Notice: The third argument indicate kind of comparison
' A textual comparison starting at position 4. Returns 6.
MyPos = Instr(4, SearchString, SearchChar, 1)
' A binary comparison starting at position 1. Returns 9.
MyPos = Instr(1, SearchString, SearchChar, 0)
' Comparison is binary by default (last argument is omitted).
MyPos = Instr(SearchString, SearchChar) ' Returns 9.
MyPos = Instr(1, SearchString, "W") ' Returns 0.