⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.jc

📁 The JILRunOnly project is a simple command-line application written in ANSI-C that is intended to de
💻 JC
字号:

/* Testing the new string methods */

import stdlib;

function test( const string& s, const var& a )
{
	stdlib::Print( s + " = \"" );
	stdlib::Print( stdlib::ToString(a) );
	stdlib::Print( "\"\n" );
}

function string main(const array& args)
{
	string test = "Hello World! This string is a test! Now the built-in string "
		"finally has methods! Hurray! JewelScript is the best language in the World!";

	test( "test", test );
	test( "test.length", test.length );
	test( "test.lastChar", test.lastChar );
	test( "test.Compare(\"Hello World!\")", test.Compare("Hello World!") );
	test( "test.CharAt(6)", test.CharAt(6) );
	test( "test.FindChar(87, 0)", test.FindChar(87, 0) );
	test( "test.FindCharReverse(87, test.length)", test.FindCharReverse(87, test.length) );
	test( "test.FindString(\"World\", 0)", test.FindString("World", 0) );
	test( "test.SpanIncluding(\"hHeElLoO\", 0)", test.SpanIncluding("hHeElLoO", 0) );
	test( "test.SpanExcluding(\" \", 0)", test.SpanExcluding(" ", 0) );
	test( "test.Insert(\"beautiful \", 6)", test.Insert("beautiful ", 6) );
	test( "test.InsertChar(87, 6)", test.InsertChar(87, 6) );
	test( "test.Remove(6, 6)", test.Remove(6, 6) );
	test( "test.Replace(\"World\", \"Script\")", test.Replace("World", "Script") );
	test( "test.SubString(6, 6)", test.SubString(6, 6) );
	test( "test.ToUpper()", test.ToUpper() );
	test( "test.ToLower()", test.ToLower() );

	test.Fill(87, 6);
	test( "test.Fill(87, 6)", test );
	
	test = "   We test Trim   ";
	test( "test.Trim()", test.Trim() );

	return "";
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -