Skip to content

Part of my series of tools for String manipulation

Notifications You must be signed in to change notification settings

ciroDourado/slice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

slice

Part of my series of tools for String manipulation

Sections

  1. Applying into your code
  2. How to use it
  3. Contribuing

1. Applying into your code

Using this library requires nothing more than moving the source-code at src/ into your project diretory that hold your .c files.

Finally, just the obvious, use GCC to compile all the code inside :

gcc *.c -o [executable_name]

Execute with (if you are in a Windows OS, use a backslash instead):

./[executable_name]

Back into sections

2. How to use it

Function Parameter Return
slice Number of bytes to be read; source String Chars read or source String reference
slice_or_copy Number of bytes to be read; source String Chars read or copied String from source
copy String to be copied Copied String

If you want to take an example, check the code inside test/, at main.c.

"slice( )" expects a number of bytes to be readen from the given string. If the String passed is null, nothing will happen. If the number of bytes does not match the boundaries of your string, it's reference is thrown back again. On the other hand, if it matches, a newly allocated string is returned back with only the specified bytes.

"slice_or_copy( )" expects a number of bytes to be readen from the given string. If the String passed is null, nothing will happen. If the number of bytes does not match the boundaries of your string, a copy is returned back. On the other hand, if it matches, a newly allocated string is returned back with only the specified bytes.

"copy( )" a string to be copied. If the String passed is null, nothing will happen, or else, a deep copy is created.

Back into sections

3. Contribuing

If you want to leave a comment, suggest an update (or anything else), mail me: ciro dot brz at gmail dot com .

Btw, I'm brazilian; my deepest apologies if I wrote something wrong, or mispelled something.

Back into sections

About

Part of my series of tools for String manipulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages