Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a7da2b

Browse files
Miner miner mods refactor 1 (#2)
2nd integration
1 parent e4ea766 commit 4a7da2b

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

‎public/consolidated/python.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -535,16 +535,17 @@
535535
"code": "def snake_to_camel(s):\n parts = s.split('_')\n return parts[0] + ''.join(word.capitalize() for word in parts[1:])\n\n# Usage:\nsnake_to_camel('hello_world') # Returns: 'helloWorld'\n"
536536
},
537537
{
538-
"title": "Convert String to ASCII",
539-
"description": "Converts a string into its ASCII representation.",
538+
"title": "Convert String to Unicode",
539+
"description": "Converts a string into its Unicode representation.",
540540
"author": "axorax",
541541
"tags": [
542542
"string",
543543
"ascii",
544+
"unicode",
544545
"convert"
545546
],
546547
"contributors": [],
547-
"code": "def string_to_ascii(s):\n return [ord(char) for char in s]\n\n# Usage:\nstring_to_ascii('hello') # Returns: [104, 101, 108, 108, 111]\n"
548+
"code": "def string_to_unicode(s):\n return [ord(char) for char in s]\n\n# Usage:\nstring_to_unicode('hello') # Returns: [104, 101, 108, 108, 111]\n"
548549
},
549550
{
550551
"title": "Count Character Frequency",
@@ -626,6 +627,18 @@
626627
"contributors": [],
627628
"code": "import random\nimport string\n\ndef random_string(length):\n letters_and_digits = string.ascii_letters + string.digits\n return ''.join(random.choice(letters_and_digits) for _ in range(length))\n\n# Usage:\nrandom_string(10) # Results: Random 10-character string\n"
628629
},
630+
{
631+
"title": "Remove Characters",
632+
"description": "Removes specific characters from a string.",
633+
"author": "axorax",
634+
"tags": [
635+
"string",
636+
"remove",
637+
"characters"
638+
],
639+
"contributors": [],
640+
"code": "def remove_chars(s, chars):\n return ''.join(c for c in s if c not in chars)\n\n# Usage:\nremove_chars('hello world', 'eo') # Returns: 'hll wrld'\n"
641+
},
629642
{
630643
"title": "Remove Duplicate Characters",
631644
"description": "Removes duplicate characters from a string while maintaining the order.",
@@ -650,18 +663,6 @@
650663
"contributors": [],
651664
"code": "import string\n\ndef remove_punctuation(s):\n return s.translate(str.maketrans('', '', string.punctuation))\n\n# Usage:\nremove_punctuation('Hello, World!') # Returns: 'Hello World'\n"
652665
},
653-
{
654-
"title": "Remove Specific Characters",
655-
"description": "Removes specific characters from a string.",
656-
"author": "axorax",
657-
"tags": [
658-
"string",
659-
"remove",
660-
"characters"
661-
],
662-
"contributors": [],
663-
"code": "def remove_chars(s, chars):\n return ''.join(c for c in s if c not in chars)\n\n# Usage:\nremove_chars('hello world', 'eo') # Returns: 'hll wrld'\n"
664-
},
665666
{
666667
"title": "Remove Whitespace",
667668
"description": "Removes all whitespace from a string.",
@@ -683,7 +684,7 @@
683684
"reverse"
684685
],
685686
"contributors": [],
686-
"code": "def reverse_string(s):\n return s[::-1]\n\n# Usage:\nreverse_string('hello') # Returns: 'olleh'\n"
687+
"code": "def reverse_string(s:str) -> str:\n return s[::-1]\n\n# Usage:\nreverse_string('hello') # Returns: 'olleh'\n"
687688
},
688689
{
689690
"title": "Split Camel Case",
@@ -698,15 +699,17 @@
698699
"code": "import re\n\ndef split_camel_case(s):\n return ' '.join(re.findall(r'[A-Z][a-z]*|[a-z]+', s))\n\n# Usage:\nsplit_camel_case('camelCaseString') # Returns: 'camel Case String'\n"
699700
},
700701
{
701-
"title": "Truncate String",
702-
"description": "Truncates a string to a specified length and adds an ellipsis.",
702+
"title": "Truncate",
703+
"description": "Truncates a string to a specified length and a toggleable truncation notation.",
703704
"author": "axorax",
704705
"tags": [
705706
"string",
706707
"truncate"
707708
],
708-
"contributors": [],
709-
"code": "def truncate_string(s, length):\n return s[:length] + '...' if len(s) > length else s\n\n# Usage:\ntruncate_string('This is a long string', 10) # Returns: 'This is a ...'\n"
709+
"contributors": [
710+
"MinerMinerMods"
711+
],
712+
"code": "def truncate(s:str, length:int, suffix:bool = True) -> str :\n return (s[:length] + (\"...\" if suffix else \"\")) if len(s) > length else s\n\n# Usage:\ntruncate('This is a long string', 10) # Returns: 'This is a ...'\ntruncate('This is a long string', 10, False) # Returns: 'This is a '\n"
710713
}
711714
]
712715
}

‎snippets/python/string-manipulation/remove-characters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Remove Specific Characters
2+
title: Remove Characters
33
description: Removes specific characters from a string.
44
author: axorax
55
tags: string,remove,characters

‎snippets/python/string-manipulation/truncate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Truncate String
2+
title: Truncate
33
description: Truncates a string to a specified length and a toggleable truncation notation.
44
author: axorax
55
contributors: MinerMinerMods

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /