Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
649901b7
Commit
649901b7
authored
Oct 08, 2015
by
Seba Gamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge doc/api/mruby/string.h.md contents
parent
4dc98697
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
include/mruby/string.h
include/mruby/string.h
+73
-0
No files found.
include/mruby/string.h
View file @
649901b7
...
...
@@ -66,6 +66,9 @@ struct RString {
#define RSTR_SET_FROZEN_FLAG(s) ((s)->flags |= MRB_STR_FROZEN)
#define RSTR_UNSET_FROZEN_FLAG(s) ((s)->flags &= ~MRB_STR_FROZEN)
/*
* Returns a pointer from a Ruby string
*/
#define mrb_str_ptr(s) ((struct RString*)(mrb_ptr(s)))
#define RSTRING(s) mrb_str_ptr(s)
#define RSTRING_PTR(s) RSTR_PTR(RSTRING(s))
...
...
@@ -85,34 +88,104 @@ mrb_int mrb_str_strlen(mrb_state*, struct RString*);
void
mrb_gc_free_str
(
mrb_state
*
,
struct
RString
*
);
MRB_API
void
mrb_str_modify
(
mrb_state
*
,
struct
RString
*
);
MRB_API
void
mrb_str_concat
(
mrb_state
*
,
mrb_value
,
mrb_value
);
/*
* Adds two strings together.
*/
MRB_API
mrb_value
mrb_str_plus
(
mrb_state
*
,
mrb_value
,
mrb_value
);
/*
* Converts pointer into a Ruby string.
*/
MRB_API
mrb_value
mrb_ptr_to_str
(
mrb_state
*
,
void
*
);
/*
* Returns an object as a Ruby string.
*/
MRB_API
mrb_value
mrb_obj_as_string
(
mrb_state
*
mrb
,
mrb_value
obj
);
/*
* Resizes the string's length.
*/
MRB_API
mrb_value
mrb_str_resize
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_int
len
);
/*
* Returns a sub string.
*/
MRB_API
mrb_value
mrb_str_substr
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_int
beg
,
mrb_int
len
);
/*
* Returns a Ruby string type.
*/
MRB_API
mrb_value
mrb_string_type
(
mrb_state
*
mrb
,
mrb_value
str
);
MRB_API
mrb_value
mrb_check_string_type
(
mrb_state
*
mrb
,
mrb_value
str
);
MRB_API
mrb_value
mrb_str_buf_new
(
mrb_state
*
mrb
,
size_t
capa
);
MRB_API
const
char
*
mrb_string_value_cstr
(
mrb_state
*
mrb
,
mrb_value
*
ptr
);
MRB_API
const
char
*
mrb_string_value_ptr
(
mrb_state
*
mrb
,
mrb_value
ptr
);
/*
* Duplicates a string object.
*/
MRB_API
mrb_value
mrb_str_dup
(
mrb_state
*
mrb
,
mrb_value
str
);
/*
* Returns a symbol from a passed in string.
*/
MRB_API
mrb_value
mrb_str_intern
(
mrb_state
*
mrb
,
mrb_value
self
);
MRB_API
mrb_value
mrb_str_to_inum
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_int
base
,
mrb_bool
badcheck
);
MRB_API
double
mrb_str_to_dbl
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_bool
badcheck
);
/*
* Returns a converted string type.
*/
MRB_API
mrb_value
mrb_str_to_str
(
mrb_state
*
mrb
,
mrb_value
str
);
/*
* Returns true if the strings match and false if the strings don't match.
*/
MRB_API
mrb_bool
mrb_str_equal
(
mrb_state
*
mrb
,
mrb_value
str1
,
mrb_value
str2
);
/*
* Returns a concated string comprised of a Ruby string and a C string.
*
* @see mrb_str_cat_cstr
*/
MRB_API
mrb_value
mrb_str_cat
(
mrb_state
*
mrb
,
mrb_value
str
,
const
char
*
ptr
,
size_t
len
);
/*
* Returns a concated string comprised of a Ruby string and a C string.
*
* @see mrb_str_cat
*/
MRB_API
mrb_value
mrb_str_cat_cstr
(
mrb_state
*
mrb
,
mrb_value
str
,
const
char
*
ptr
);
MRB_API
mrb_value
mrb_str_cat_str
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_value
str2
);
#define mrb_str_cat_lit(mrb, str, lit) mrb_str_cat(mrb, str, lit, mrb_strlen_lit(lit))
/*
* Adds str2 to the end of str1.
*/
MRB_API
mrb_value
mrb_str_append
(
mrb_state
*
mrb
,
mrb_value
str
,
mrb_value
str2
);
/*
* Returns 0 if both Ruby strings are equal. Returns a value < 0 if Ruby str1 is less than Ruby str2. Returns a value > 0 if Ruby str2 is greater than Ruby str1.
*/
MRB_API
int
mrb_str_cmp
(
mrb_state
*
mrb
,
mrb_value
str1
,
mrb_value
str2
);
/*
* Returns a C string from a Ruby string.
*/
MRB_API
char
*
mrb_str_to_cstr
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_pool
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_int
mrb_str_hash
(
mrb_state
*
mrb
,
mrb_value
str
);
mrb_value
mrb_str_dump
(
mrb_state
*
mrb
,
mrb_value
str
);
/*
* Returns a printable version of str, surrounded by quote marks, with special characters escaped.
*/
mrb_value
mrb_str_inspect
(
mrb_state
*
mrb
,
mrb_value
str
);
void
mrb_noregexp
(
mrb_state
*
mrb
,
mrb_value
self
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment