⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bstring.doc

📁 输入16个数字进行加密
💻 DOC
📖 第 1 页 / 共 2 页
字号:
  ---------------------------------

  BASIC: dstring = MID$(sstring, start, n)
  C:     mid(dstring, sstring, start, n);

  BASIC: dstring = MID$(sstring, start)
  C:     mid(dstring, sstring, start, -1);

  PROTOTYPE: char* mid(char* dstring, char* sstring, int start, int n);

  DETAILS: mid() sets dstring to the n characters of sstring beginning with the
  start character position.  Character positions are numbered 1 and upward.  If
  sstring does not contain n characters from the start position, dstring is
  terminated with the last character of sstring.
     If start = 0 or n = 0 (invalid values), mid() sets dstring to null.  If
  start > len(sstring), mid() sets dstring to null.
     Under C++, either or both of start and n may be omitted.  If omitted, start
  defaults to 1 and n defaults to -1 (0xffff).










                                        3



  Compare Strings
  ---------------

  BASIC: ShortInt = (dstring <= sstring) - (dstring >= sstring)
  C:     ShortInt = cmpstr(dstring, sstring);

  PROTOTYPE: int cmpstr(char* dstring, char* sstring);

  DETAILS: cmpstr() compares dstring to sstring.  If the strings are equal,
  cmpstr() returns 0.  If dstring is greater, cmpstr() returns 1.  If sstring is
  greater, cmpstr() returns -1.  Neither string is modified.


  Search for Substring
  --------------------

  BASIC: ShortInt = INSTR(start, sstring, substring)
  C:     ShortInt = instr(sstring, substring, start);

  BASIC: ShortInt = INSTR(sstring, substring)
  C:     ShortInt = instr(sstring, substring, 1);

  PROTOTYPE: int instr(char* sstring, char* substring, int start);

  DETAILS: instr() searches sstring for an occurrence of substring.  The search
  begins at the character position supplied in start (first character = 1).  If
  substring is found, instr() returns the character position at which substring
  begins.  Character positions are numbered 1 upward.  If substring is not
  found, instr() returns 0.
     If start = 0 (an invalid value), instr() returns 0.  If start >
  len(sstring), instr() returns 0.  If substring is null, instr() returns start.
     Under C++, start may be omitted, in which event, start defaults to 1.


  Compute Value of Numeric String
  -------------------------------

  BASIC: LongInt = VAL(sstring)
  C:     LongInt = val(sstring);

  PROTOTYPE: long val(char* sstring);

  BASIC: LongInt = VAL(sstring);
  C:     LongInt = valh(sstring);            /* sstring is hexadecimal */

  PROTOTYPE: long valh(char* sstring);

  BASIC: DoubleFloat = VAL(sstring);
  C:     DoubleFloat = vald(sstring);

  PROTOTYPE: double vald(char* sstring);

  DETAILS: val() will accept a hexadecimal string provided that it is prefixed
  with 0x or 0X (e.g. 0xffff).  valh() assumes an unsigned hexadecimal string
  with no prefix.  Hexadecimal strings may use either upper or lower case
  letters.
     vald() will accept either standard or scientific notation.  vald() uses
  numeric processor instructions; therefore, a numeric processor must either be
  present or an emulator must be installed.

                                        4



  Convert Numeric to String
  -------------------------

  BASIC: dstring = STR$(LongInt)
  C:     str(dstring, LongInt);

  PROTOTYPE: char* str(char* dstring, long intnum);

  BASIC: dstring = HEX$(LongInt);
  C:     hex(dstring, LongInt);

  PROTOTYPE: char* hex(char* dstring, long intnum);

  BASIC: dstring = STR$(DoubleFloat)
  C:     strd(dstring, DoubleFloat, n);
  C:     strds(dstring, DoubleFloat, n);

  PROTOTYPE: char* strd(char* dstring, double floatval, int decimals);
  PROTOTYPE: char* strds(char* dstring, double floatval, int decimals);

  DETAILS: hex() always returns a string 8 characters long.  The digits will
  always be upper case.  No prefix is prepended to the string.
     strd() returns dstring in standard notation whereas strds() returns dstring
  in scientific notation.  n specifies the number of decimal places.  For
  strds(), n specifies the number of decimal places in the mantissa.  strd()
  cannot convert numbers absolutely greater than or equal to 2 ^ 63.  Such
  numbers will be converted to scientific notation instead.  strd() and strds()
  use numeric processor instructions; therefore, a numeric processor must either
  be present or an emulator must be installed.


  Remove Spaces from Right or Left of String
  ------------------------------------------

  BASIC: dstring = LTRIM$(sstring)
  C:     ltrim(dstring, sstring);

  PROTOTYPE: char* ltrim(char* dstring, char* sstring);

  BASIC: dstring = RTRIM$(sstring)
  C:     rtrim(dstring, sstring);

  PROTOTYPE: char* rtrim(char* dstring, char* sstring);


  Return String of Spaces
  -----------------------

  BASIC: dstring = SPACE$(n);
  C:     space(dstring, n);

  PROTOTYPE: char* space(char* dstring, int n);

  DETAILS: If n = 0 (invalid value), dstring is returned as null.






                                        5



  Return String of Repeated Character
  -----------------------------------

  BASIC: dstring = STRING$(n, ASCIIcode)
  C:     string(dstring, n, ASCIIcode);

  PROTOTYPE: char* string(char* dstring, int n, int asciicode);

  DETAILS: If n = 0 (invalid value), dstring is returned as null.


  Convert String to Lower or Upper Case
  -------------------------------------

  BASIC: dstring = LCASE$(sstring)
  C:     lcase(dstring, sstring);

  PROTOTYPE: char* lcase(char* dstring, char* sstring);

  BASIC: dstring = UCASE$(sstring)
  C:     ucase(dstring, sstring);

  PROTOTYPE: char* ucase(char* dstring, char* sstring);


  Justify String Within Fixed Field
  ---------------------------------

  BASIC: dstring = SPACE$(n): LSET dstring = sstring
  C:     lset(dstring, sstring, n);

  PROTOTYPE: char* lset(char* dstring, char* sstring, int n);

  BASIC: dstring = SPACE$(n): RSET dstring = sstring
  C:     rset(dstring, sstring, n);

  PROTOTYPE: char* rset(char* dstring, char* sstring, int n);

  DETAILS: dstring is always returned with length n.  sstring is left-justified
  or right-justified within dstring.  The remainder of dstring is filled with
  spaces.  If len(sstring) >= n, both lset() and rset() return dstring =
  left(sstring, n).
     If n = 0 (invalid value), dstring is returned as null.
     Observe that the LSET() and RSET() functions in BASIC implicitly set n =
  len(dstring).















                                        6



  Check Syntax of Numeric String
  ------------------------------

  BASIC: no equivalent
  C:     ShortInt = intchk(sstring);
  C:     ShortInt = floatchk(sstring);

  PROTOTYPE: int intchk(char *sstring);
  PROTOTYPE: int floatchk(char *sstring);

  Details: intchk() evaluates sstring to determine if it qualifies as an integer
  representation.  intchk() returns: 0 if the string does not qualify as an
  integer, 1 if the string represents a numeric zero, 2 if the string represents
  a positive number, and -2 if the string represents a negative number.
  floatchk() determines if a string qualifies as a floating point
  representation.  Return values for floatchk() are the same as intchk().
     intchk() will accept hexadecimal strings provided that they are prefixed
  with 0x or 0X.  floatchk() will accept either standard or scientific notation.
     These functions are included to overcome deficiencies in the BASIC VAL
  function.  VAL converts numerics up to the first nonnumeric character.  These
  presence of such characters is often indicative of mistyped user input.
  intchk() and floatchk() can be used to examine user input before attempts to
  convert such input with val() and vald().





































                                        7

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -