If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > how to convert string to character

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-04, 23:59
azifa7980 azifa7980 is offline
Registered User
 
Join Date: Aug 2004
Posts: 15
how to convert string to character

hello,
I am using Visual Fox Pro 6.0. I have a form where have 4 text fields.
1) IML No.
2) New Part No.
3) Original Part No.
4) Employee ID
(note: new part no.=original part no.)
example:
IML No.:15600001000 (scan barcode)
New Part No.:fpt15600001000a3841750030 (scan barcode)
Original Part No.:fpt15600001000a3841750030 (scan barcode)
Employee ID:YY0111
So, the system will compare the iml no.,new part no. and original part no. When the employee scan their employee id, pop up message either "Pass"(if iml no.=new part no.=original part no.) or "Fail'.
The problem is the iml no. can't compare with the new part no. and original part no. The message always show "Fail". So what I want is when it compare the iml no., the first 3 digits and last 11 digits from the new part no. and original part no. are ignore.
If there are solution to help me to solve this problem. Please help me.
Thank you.
Reply With Quote
  #2 (permalink)  
Old 08-11-04, 09:10
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
Arrow mid function

Hi

im not fox programmer but vb
but cant u use something like
the mid function
mid(string,start,length)

so
Original Part No = fpt15600001000a3841750030
IML No =15600001000


MyNo = Mid(Original Part No, 3, len(Original Part No))
if MyNo = IML No then ok
Reply With Quote
  #3 (permalink)  
Old 08-11-04, 23:06
azifa7980 azifa7980 is offline
Registered User
 
Join Date: Aug 2004
Posts: 15
re:mid fuction

thank you for your suggestion. but can you show me the full program of using the mid function because i am not so good in vb. so can you guide me to do the program.

thank you.
Reply With Quote
  #4 (permalink)  
Old 08-12-04, 03:20
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
Post mid function

Mid Function


Returns a Variant (String) containing a specified number of characters from a string.

Syntax

Mid(string, start[, length])

The Mid function syntax has thesenamed arguments:

Part Description
string Required.String expression from which characters are returned. If string containsNull, Null is returned.
start Required;Long. Character position in string at which the part to be taken begins. If start is greater than the number of characters in string, Mid returns a zero-length string ("").
length Optional; Variant (Long). Number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.


Remarks

To determine the number of characters in string, use the Len function.

Note Use the MidB function with byte data contained in a string, as in double-byte character set languages. Instead of specifying the number of characters, thearguments specify numbers of bytes. For sample code that uses MidB, see the second example in the example topic.
Reply With Quote
  #5 (permalink)  
Old 08-12-04, 03:21
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
Post Mid Function Example

The first example uses the Mid function to return a specified number of characters from a string.

Dim MyString, FirstWord, LastWord, MidWords
MyString = "Mid Function Demo" ' Create text string.
FirstWord = Mid(MyString, 1, 3) ' Returns "Mid".
LastWord = Mid(MyString, 14, 4) ' Returns "Demo".
MidWords = Mid(MyString, 5) ' Returns "Function Demo".

The second example use MidB and a user-defined function (MidMbcs) to also return characters from string. The difference here is that the input string is ANSI and the length is in bytes.

Function MidMbcs(ByVal str as String, start, length)
MidMbcs = StrConv(MidB(StrConv(str, vbFromUnicode), start, length), vbUnicode)
End Function

Dim MyString
MyString = "AbCdEfG"
' Where "A", "C", "E", and "G" are DBCS and "b", "d",
' and "f" are SBCS.
MyNewString = Mid(MyString, 3, 4)
' Returns ""CdEf"
MyNewString = MidB(MyString, 3, 4)
' Returns ""bC"
MyNewString = MidMbcs(MyString, 3, 4)
' Returns "bCd"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On