Revert "Refine examples."

This reverts commit 146129279c.
This commit is contained in:
Stephen Chung
2022-01-16 22:50:39 +08:00
parent 146129279c
commit 5935a88958
6 changed files with 43 additions and 32 deletions

View File

@@ -1,7 +1,5 @@
///! This example registers a variety of functions that operate on strings.
///! Remember to use `ImmutableString` or `&str` instead of `String` as parameters.
#![cfg(not(feature = "no_object"))]
use rhai::{Engine, EvalAltResult, ImmutableString, Scope};
use std::io::{stdin, stdout, Write};
@@ -66,10 +64,10 @@ fn main() -> Result<(), Box<EvalAltResult>> {
engine.run_with_scope(
&mut scope,
r#"
display("Length", x.len);
display("Length", x.len());
x.trim();
display("Trimmed", x);
display("Trimmed Length", x.len);
display("Trimmed Length", x.len());
display("Index of \"!!!\"", x.index_of("!!!"));
"#,
)?;