1+ [
2+ {
3+ "categoryName" : " Basics" ,
4+ "snippets" : [
5+ {
6+ "title" : " Hello, World!" ,
7+ "description" : " Prints Hello, World! to the terminal." ,
8+ "code" : [
9+ " public class HelloWorld {" ,
10+ " public static void main(String[] args) {" ,
11+ " // Output: \" Hello, World!\" " ,
12+ " System.out.println(\" Hello, World!\" );" ,
13+ " }" ,
14+ " }"
15+ ],
16+ "tags" : [" java" , " hello-world" ],
17+ "author" : " axorax"
18+ }
19+ ]
20+ },
21+ {
22+ "categoryName" : " String Manipulation" ,
23+ "snippets" : [
24+ {
25+ "title" : " Reverse String" ,
26+ "description" : " Reverses the characters in a string." ,
27+ "code" : [
28+ " public class StringManipulation {" ,
29+ " public static String reverseString(String s) {" ,
30+ " StringBuilder reversed = new StringBuilder(s);" ,
31+ " return reversed.reverse().toString();" ,
32+ " }" ,
33+ " " ,
34+ " // Usage:" ,
35+ " public static void main(String[] args) {" ,
36+ " System.out.println(reverseString('hello')); // Output: 'olleh'" ,
37+ " }" ,
38+ " }"
39+ ],
40+ "tags" : [" java" , " string" , " reverse" , " utility" ],
41+ "author" : " axorax"
42+ },
43+ {
44+ "title" : " Check Palindrome" ,
45+ "description" : " Checks if a string is a palindrome." ,
46+ "code" : [
47+ " public class StringManipulation {" ,
48+ " public static boolean isPalindrome(String s) {" ,
49+ " String cleanString = s.replaceAll(\"\\ s+\" , \"\" ).toLowerCase();" ,
50+ " StringBuilder reversed = new StringBuilder(cleanString);" ,
51+ " return cleanString.equals(reversed.reverse().toString());" ,
52+ " }" ,
53+ " " ,
54+ " // Usage:" ,
55+ " public static void main(String[] args) {" ,
56+ " System.out.println(isPalindrome('A man a plan a canal Panama')); // Output: true" ,
57+ " }" ,
58+ " }"
59+ ],
60+ "tags" : [" java" , " string" , " palindrome" , " check" ],
61+ "author" : " axorax"
62+ },
63+ {
64+ "title" : " Count Vowels" ,
65+ "description" : " Counts the number of vowels in a string." ,
66+ "code" : [
67+ " public class StringManipulation {" ,
68+ " public static int countVowels(String s) {" ,
69+ " int count = 0;" ,
70+ " String vowels = 'aeiouAEIOU';" ,
71+ " for (int i = 0; i < s.length(); i++) {" ,
72+ " if (vowels.indexOf(s.charAt(i)) != -1) {" ,
73+ " count++;" ,
74+ " }" ,
75+ " }" ,
76+ " return count;" ,
77+ " }" ,
78+ " " ,
79+ " // Usage:" ,
80+ " public static void main(String[] args) {" ,
81+ " System.out.println(countVowels('hello')); // Output: 2" ,
82+ " }" ,
83+ " }"
84+ ],
85+ "tags" : [" java" , " string" , " vowels" , " count" ],
86+ "author" : " axorax"
87+ },
88+ {
89+ "title" : " Find Substring First Occurrence" ,
90+ "description" : " Finds the first occurrence of a substring in a string." ,
91+ "code" : [
92+ " public class StringManipulation {" ,
93+ " public static int findSubstring(String s, String substring) {" ,
94+ " return s.indexOf(substring);" ,
95+ " }" ,
96+ " " ,
97+ " // Usage:" ,
98+ " public static void main(String[] args) {" ,
99+ " System.out.println(findSubstring('hello world', 'world')); // Output: 6" ,
100+ " }" ,
101+ " }"
102+ ],
103+ "tags" : [" java" , " string" , " substring" , " search" ],
104+ "author" : " axorax"
105+ },
106+ {
107+ "title" : " Capitalize First Letter" ,
108+ "description" : " Capitalizes the first letter of a string." ,
109+ "code" : [
110+ " public class StringManipulation {" ,
111+ " public static String capitalizeFirstLetter(String s) {" ,
112+ " if (s == null || s.isEmpty()) {" ,
113+ " return s;" ,
114+ " }" ,
115+ " return s.substring(0, 1).toUpperCase() + s.substring(1);" ,
116+ " }" ,
117+ " " ,
118+ " // Usage:" ,
119+ " public static void main(String[] args) {" ,
120+ " System.out.println(capitalizeFirstLetter('hello')); // Output: 'Hello'" ,
121+ " }" ,
122+ " }"
123+ ],
124+ "tags" : [" java" , " string" , " capitalize" , " utility" ],
125+ "author" : " axorax"
126+ }
127+ ]
128+ }
129+ ]
0 commit comments