The PLVprs (PL/Vision PaRSe) package offers a set of programs which provide generic and flexible string parsing capabilities. See
Chapter 10,
PLVprs, PLVtkn, and PLVprsps: Parsing Strings
for details.
-
c_ignore_case CONSTANT VARCHAR2(1) := 'I';
-
c_respect_case CONSTANT VARCHAR2(1) := 'R';
-
Use these constants to indicate whether you want case to be ignored or respected in the current operation.
-
c_all CONSTANT VARCHAR(3) := 'ALL';
-
c_word CONSTANT VARCHAR(4) := 'WORD';
-
c_delim CONSTANT VARCHAR(5) := 'DELIM';
-
The different types of atomics;
c_all
indicates "all atomics";
c_word
indicates "words only";
c_delim
indicates "delimiters only".
-
std_delimiters CONSTANT VARCHAR2 (50) :=
-
'!@#$%^&*()-_=+\|`~{{]};:''",<.>/?' ||
-
PLVchr.newline_char || PLVchr.tab_char || PLVchr.space_char;
-
The standard set of delimiter characters.
-
plsql_delimiters CONSTANT VARCHAR2 (50) :=
-
'!@%^&*()-=+\|`~{{]};:''",<.>/?' ||
-
PLVchr.newline_char || PLVchr.tab_char || PLVchr.space_char;
-
The set of delimiters for the
PL/SQL
language; this list is a bit different from the
std_delimiters
. The underscore and pound sign characters, for example, are not delimiters in
PL/SQL
.
5.21.2
Wrapping long strings into paragraphs
-
PROCEDURE wrap
-
(text_in IN VARCHAR2,
-
line_length IN INTEGER,
-
paragraph_out IN OUT PLVtab.vc2000_table,
-
num_lines_out IN OUT INTEGER);
-
Wraps the string provided by
text_in
into separate lines with a maximum specified length, each line of which is stored in consecutive rows in a
PL/SQL
table.
-
FUNCTION wrapped_string
-
(text_in IN VARCHAR2,
-
line_length IN INTEGER := 80,
-
prefix_in IN VARCHAR2 := NULL)
-
RETURN VARCHAR2;
-
Returns a long string wrapped into a series of lines separated by newline characters. This version of wrap avoids the need to define and manipulate a
PL/SQL
table.
-
PROCEDURE display_wrap
-
(text_in IN VARCHAR2,
-
line_length IN INTEGER := 80,
-
prefix_in IN VARCHAR2 := NULL);
-
Displays the wrapped version of
text_in
using the
p.l
procedure (and DBMS_OUTPUT.PUT_LINE).
-
FUNCTION next_atom_loc
-
(string_in IN VARCHAR2,
-
start_loc_in IN NUMBER,
-
direction_in IN NUMBER := +1,
-
delimiters_in IN VARCHAR2 := std_delimiters)
-
RETURN INTEGER;
-
Returns the location in the string of the next atomic. You provide the starting location of the scan, the direction of the scan (usually +1 or -1, but you can provide other values as well), and the delimiters to be used in the scan.
-
FUNCTION numatomics
-
(string_in IN VARCHAR2,
-
count_type_in IN VARCHAR2 := c_all,
-
delimiters_in IN VARCHAR2 := std_delimiters)
-
RETURN INTEGER;
-
Returns the number of atomics in a string, where the definition of an atomic is provided by the count type (all or word or delimiter) and the set of delimiters.
-
FUNCTION nth_atomic
-
(string_in IN VARCHAR2,
-
nth_in IN NUMBER,
-
count_type_in IN VARCHAR2 := c_all,
-
delimiters_in IN VARCHAR2 := std_delimiters)
-
RETURN VARCHAR2;
-
Returns the
n
th atomic in a string, where the definition of an atomic is provided by the count type (all or word or delimiter) and the set of delimiters.
-
FUNCTION numinstr
-
(string_in IN VARCHAR2,
-
substring_in IN VARCHAR2,
-
ignore_case_in IN VARCHAR2 := c_ignore_case)
-
RETURN INTEGER;
-
Returns the number of times a substring occurs in a string. You can choose to perform a search that is case-sensitive or that ignores case.
-
PROCEDURE string
-
(string_in IN VARCHAR2,
-
atomics_list_out OUT PLVtab.vc2000_table,
-
num_atomics_out IN OUT NUMBER,
-
delimiters_in IN VARCHAR2 := std_delimiters);
-
Parses a string into atomics that are loaded into a
PL/SQL
table. You decide which characters will serve as the delimiters.
-
PROCEDURE string
-
(string_in IN VARCHAR2,
-
atomics_list_out IN OUT VARCHAR2,
-
num_atomics_out IN OUT NUMBER,
-
delimiters_in IN VARCHAR2 := std_delimiters);
-
Parses a string into atomics stored in a string with each atomic separated by a vertical bar. Once again, you decide which characters will serve as the delimiters.
-
PROCEDURE display_atomics
-
(string_in IN VARCHAR2,
-
delimiters_in IN VARCHAR2 := std_delimiters);
-
Displays the individual atomics in a string, as defined by the provided list of delimiters.
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.
|
|