summaryrefslogtreecommitdiffstats
path: root/2023/rs
diff options
context:
space:
mode:
Diffstat (limited to '2023/rs')
-rw-r--r--2023/rs/code/one/src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/2023/rs/code/one/src/main.rs b/2023/rs/code/one/src/main.rs
index 1b04f08..638b9a5 100644
--- a/2023/rs/code/one/src/main.rs
+++ b/2023/rs/code/one/src/main.rs
@@ -23,6 +23,8 @@ fn main() {
let calvals = valueified.map(|s| {
let mut d1 = 0;
let mut d2 = 0;
+
+ let mut indexoff = 0;
for i in 0..s.len() {
let c = s[i];
if c >= b'0' && c <= b'9' {
@@ -32,9 +34,10 @@ fn main() {
else {
for i2 in 0..NUMS.len() {
let num = NUMS[i2];
- if s.len() >= i + num.len() && &s[i..i+num.len()] == num {
+ if s[i..].starts_with(num) {
if d1 == 0 { d1 = i2 as u8 + b'1'; }
d2 = i2 as u8 + b'1';
+ break;
}
}
}