LoslegenKostenlos loslegen

Slicing strings

When working with text data, slicing out the pieces you need is very important. Using this method, you can often turn text data into neat, structured data.

In this example, you are extracting information from a string of data regarding a customer's order at an online shop.

The string you are examining is:

order_data = "| customer-id: 13415 | order-number: 000019034 |";

The customer-id number is a 5-digit number starting from the 16th character of the string. The order-number is an 9-digit number starting from the 38th character of the string.

The string order_data is available in your environment.

Diese Übung ist Teil des Kurses

Introduction to Julia

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Slice out the customer-id
customer_id = ____
Code bearbeiten und ausführen