Skip to content

Instantly share code, notes, and snippets.

View lowercasebtw's full-sized avatar

lowercasebtw lowercasebtw

  • United States
  • 20:21 (UTC -05:00)
View GitHub Profile
@lowercasebtw
lowercasebtw / cmd_v1.7.js
Created March 13, 2024 23:09
Pre 1.13 Minecraft Command Parser (Update 1.7: Rework a lot of stuff, error cleanup & new message, & more)
class CharUtil {
/**
* Check if ch is a alphabetic letter
* @param {string} ch
* @returns {boolean}
*/
static is_alpha(ch) {
const lower = "abcdefghijklmnopqrstuvwxyz";
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
@lowercasebtw
lowercasebtw / cmd_v1.6.js
Created March 13, 2024 04:50
Pre 1.13 Minecraft Command Parser (Update 1.6: idk i did some clean up i think)
class CharUtil {
static is_alpha(ch) {
const lower = "abcdefghijklmnopqrstuvwxyz";
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_numeric(ch) {
return "0123456789".includes(ch);
}
@lowercasebtw
lowercasebtw / cmd_v1.5.js
Created March 13, 2024 02:00
Pre 1.13 Minecraft Command Parser (Update 1.5: Conversion to JS value)
class CharUtil {
static is_alpha(ch) {
const lower = "abcdefghijklmnopqrstuvwxyz";
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_numeric(ch) {
return "0123456789".includes(ch);
}
@lowercasebtw
lowercasebtw / cmd_v1.4.js
Created March 13, 2024 01:30
Pre 1.13 Minecraft Command Parser (Update 1.4: Cleanup)
class CharUtil {
static is_alpha(ch) {
const lower = 'abcdefghijklmnopqrstuvwxyz';
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_space(ch) {
return ' \r\n\t'.includes(ch);
}
}
@lowercasebtw
lowercasebtw / cmd_v1.3.js
Created March 13, 2024 01:23
Pre 1.13 Minecraft Command Parser (Update 1.3: Fix bugs and error handling)
class CharUtil {
static is_alpha(ch) {
const lower = 'abcdefghijklmnopqrstuvwxyz';
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_space(ch) {
return ' \r\n\t'.includes(ch);
}
}
@lowercasebtw
lowercasebtw / cmd_v1.2.js
Created March 13, 2024 01:19
Pre 1.13 Minecraft Command Parser (Update 1.2: Added REPL to the command line options)
class CharUtil {
static is_alpha(ch) {
const lower = 'abcdefghijklmnopqrstuvwxyz';
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_space(ch) {
return ' \r\n\t'.includes(ch);
}
}
@lowercasebtw
lowercasebtw / cmd_v1.1.js
Created March 13, 2024 00:49
Pre 1.13 Minecraft Command Parser (Update 1.1: Add Deno/Bun/Node support)
class CharUtil {
static is_alpha(ch) {
const lower = 'abcdefghijklmnopqrstuvwxyz';
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_space(ch) {
return ' \r\n\t'.includes(ch);
}
}
@lowercasebtw
lowercasebtw / cmd_v1.js
Created March 13, 2024 00:26
Pre 1.13 Minecraft Command Parser
class CharUtil {
static is_alpha(ch) {
const lower = 'abcdefghijklmnopqrstuvwxyz';
return lower.includes(ch) || lower.toUpperCase().includes(ch);
}
static is_space(ch) {
return ' \r\n\t'.includes(ch);
}
}
#include <assert.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
namespace Character {
bool isalphalower(char c) { return c >= 97 && c <= 122; }
bool isalphaupper(char c) { return c >= 65 && c <= 90; }
bool isalpha(char c) { return isalphalower(c) || isalphaupper(c); }
bool isnumeric(char c) { return c >= 48 && c <= 57; }