There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
using System; | |
using System.Text.RegularExpressions; | |
// NOTE: Change min length to 4 (instead of 5) in the RegEx if you want to include/allow NFT/Fragment usernames | |
bool ValidateTelegramUsername(string username) | |
=> Regex.IsMatch(username.TrimStart('@'), | |
@"^(?=.{5,32}$)(?!.*__)(?!^(telegram|admin|support))[a-z][a-z0-9_]*[a-z0-9]$", | |
RegexOptions.IgnoreCase | RegexOptions.Compiled); | |
Console.WriteLine(ValidateTelegramUsername("Laiteux1")); // True |
There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
<?php | |
/** | |
* ManiaLive - Freezone Plugin | |
* | |
* @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com) | |
* @version $Revision: 3705 $: | |
* @author $Author: philippe $: | |
* @date $Date: 2011-05-09 13:04:04 +0200 (lun., 09 mai 2011) $: | |
*/ |
__author__ = 'Rand0mb0t' | |
# Code for ASCII-ART Flipper | |
img_file = str(input("select an input file : ")) | |
save_file = str(input("Select an output file : ")) | |
with open(img_file,"r") as file: # Open art- file | |
lines = file.read().split('\n') | |
while '' in lines: # Remove any empty lines from file | |
lines.remove('') |
<?php | |
function getTelegramAvatar($username='') | |
{ | |
$username = $username; | |
$username = str_replace('@', '', $username); | |
$baseURL = 'https://telegram.me/'; | |
$pageURL = $baseURL . $username; |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
namespace Tests | |
{ | |
/// <summary> |
curl -L http://bit.ly/10hA8iC | bash |