Home > database >  VFP process in the string of characters
VFP process in the string of characters

Time:09-27



In the figure above the string "fatty liver" was taken out of others in the database data
I'm going to add a string such as "111" in the middle to wrap but with CRH (13) no
Later found out that there is an invisible behind "fatty liver" ANSI code is 206 characters
Such circumstance how to add line breaks

Pay attention to the disorderly character is not fixed
I got a web site to check the current mess is ASCII characters not found ANSI code but the content is same,,,

ASCII corresponding characters for 206?
ASCII corresponding characters for 219?
ASCII code 181 corresponding characters for mu
ASCII code 175 corresponding characters for ˉ

CodePudding user response:

CRH (13) is a carriage return, CRH (10) is a newline

CodePudding user response:

Unix, use "\ n" newline
Mac, use "\ r" newline
Windows, use "\ r \ n" newline
So you had better use CRH (13) + CRH (10)

CodePudding user response:

refer to the second floor DKFDTF response:
Unix, use "\ n" newline
Mac, use "\ r" newline
Windows, use "\ r \ n" newline
So you had better use CRH (13) + CRH (10)

The key is not a carriage return and line feed I have tried both at ordinary times can be the end because the string has a random character

CodePudding user response:

? "Fatty liver" + CRH (206) + CRH (10) + '111' & amp; & This certainly can't see the random characters
Just half an invalid characters didn't take out, to remove can also
S='fatty liver + CRH (219)
S=Strconv (Rtrim (Strconv (s) 5, 0 h0000), 6)
? S + CRH (13) + '111'

CodePudding user response:

A="fatty liver"
? A
? LEN (a)
? ASC (a, 1) (RIGHT)
? '111' + CRH (10) + a

Chinese character consists of two bytes, you can see it is the second liver word 206 bytes of code

CodePudding user response:

I also met, 挻 trouble, good directly directly cut to length line,

CodePudding user response:

Reference:
PROC FHZSTR

The PARAMETER m.q _com, m.q _nn

* m.q _com=
* m.q _nn=

* parameters: the string, the width
* returns: from the left, the string tail has half of Chinese characters get rid of the tail when half of Chinese characters

* PRIVATE ALL LIKE q_ *
* PRIVATE m.q _com
* PRIVATE m.q _nn

PRIVATE m.q _com1
PRIVATE m.q _n1
PRIVATE m.q _n2

IF the TYPE (" m.q _com ") # "C"
M.q _com=""
ENDI

IF the TYPE (" m.q _nn ") # "N"
M.q _nn=LEN (m.q _com)
ENDI

M.q _com1=LEFT (m.q _com, m.q _nn)
M.q _nn=LEN (m.q _com1)

M.q _n1=1
M.q _n2=0
The DO WHILE m.q _n1 & lt;=m.q _nn
IF (m.p _dbk_chs. AND. Fisachs (SUBS (m.q _com1, m.q _n1, 2))). The OR. (m.p _dbk_cht. AND. Fisacht (SUBS (m.q _com1, m.q _n1, 2)))
M.q _n1=m.q _n1 + 2
M.q _n2=m.q _n1
LOOP
ENDI
IF (m.p _dbk_chs. AND.!!! Fisachs (SUBS (m.q _com1, m.q _n1, 1) + CRH (200))). The OR. (m.p _dbk_cht. AND.!!!! Fisacht (SUBS (m.q _com1, m.q _n1, 1) + CRH (200)))
M.q _n1=m.q _n1 + 1
M.q _n2=m.q _n1
LOOP
ENDI
M.q _n1=m.q _n1 + 1
ENDDO
IF m.q _n2=m.q _nn + 1
M.q _com1=LEFT (m.q _com, m.q _nn)
M.q _com=SUBS (m.q _com, m.q _nn + 1)
The ELSE
M.q _com1=LEFT (m.q _com, m.q _nn - 1)
M.q _com=SUBS (m.q _com, m.q _nn - 1) + 1)
ENDI

RETU m.q _com1

* END OF PROC FHZSTR.

PROC FISACHS

The PARAMETER m.q _vexp

* m.q _vexp=

* parameters: the characters
* returns: for simplified Chinese characters (GBK). T.
* otherwise. F.

RETU BETWEEN (ASC (SUBS (m.q _vexp, 1, 1)), 129254). AND..
(BETWEEN (ASC (SUBS (m.q _vexp, 2, 1)), 64126). The OR. BETWEEN (ASC (SUBS (m.q _vexp, 2, 1)), 128254))

* END OF PROC FISACHS.


PROC FISACHT

The PARAMETER m.q _vexp

* m.q _vexp=

* parameters: the characters
* returns: for traditional Chinese characters (BIG5). T.
* otherwise. F.

RETU BETWEEN (ASC (SUBS (m.q _vexp, 1, 1)), 161254). AND..
(BETWEEN (ASC (SUBS (m.q _vexp, 2, 1)), 64126). The OR. BETWEEN (ASC (SUBS (m.q _vexp, 2, 1)), 161254))

* END OF PROC FISACHT.



? FHZSTR (s, len (s))

CodePudding user response:

Can get rid of these characters to a line break CRH (13) + CRH (10)

CodePudding user response:

See the moderator reply again, feeling, ten beans three, lighten the road forward for learners of VFP,

CodePudding user response:

Add a space behind + CRH (13) + CRH (10) line not line?
  •  Tags:  
  • VFP
  • Related