GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Anotra/stringc

BranchesTags
Open more actions menu

Latest commit

 

History

98 Commits
98 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
include/stringc
include/stringc
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

stringc

stringc/string.h

  size_t len;
  char *dup = strduplen("Hello World!, Привет мир!", &len);
  size_t len8;
  bool is_valid_utf8 = utf8validate(dup, NULL, &len8);
  printf("%zu, %zu\nutf8_valid: %s, len=%zu\n", len, utf8len(dup, NULL), is_valid_utf8 ? "t" : "f", len8); 
  free(dup);

base64 encoding/decoding

  const char *string = "Hello World!!";
  char encoded[64], decoded[64];
  size_t encoded_len, decoded_len;
  base64encodes(encoded, sizeof encoded, &encoded_len, string, 0);
  base64decodes(decoded, sizeof decoded, &decoded_len, encoded, 0);
  printf(
    "%s\n%s\n%s\n"
    "String Length: %zu\nEncoding Length: %zu\nsuccess: %c\n", 
    string, encoded, decoded,
    decoded_len, encoded_len, strcmp(string, decoded) == 0 ? 'T' : 'F'
  );

Output

  Hello World!!
  SGVsbG8gV29ybGQhIQ==
  Hello World!!
  String Length: 13
  Encoding Length: 20
  success: T

stringc/stringbuilder.h

  stringbuilder *sb = stringbuilder_create();
  stringbuilder_append(sb, "Hello World!");
  stringbuilder_insert(sb, 0, "HELLO WORLD!\n");
  printf("%s", stringbuilder_string(sb));
  stringbuilder_destroy(sb);

stringc/stringjoiner.h

  stringjoiner *sj = stringjoiner_create("[", ", ", "]", "[]");
  for (int i=0; i<100; i++)
    stringjoiner_addf(sj, "Item #%i", i);
  printf("%s\n", stringjoiner_string(sj));
  stringjoiner_destroy(sj);

About

No description or website provided.

Topics

base64string-manipulationstringbuilderstringjoinerutf8

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.