delete student record from text file
How do i delete a student record from a text file via there student number. I tried using contains. But that only allows for a string amd the student number is an int.
if the student number is part of a text file it will be part of a string. Load each row of the text file in an array of strings Go through the array and if you find a substring that equals the number of the student, delete the corresponding row. According to how the data is structured you may want to check only a defined part of each row to avoid that your program matches the sudent number within, let's say the phone number or the address of another student.
These are examples for storing each line of a text file into strings https://howtodoinjava.com/core-java/io/java-read-file-to-string-examples/ and find a substring within a string http://www.geeksforgeeks.org/searching-for-character-and-substring-in-a-string/
have you tried using Hashmaps?
No, I have no idea how to use that....
Would you be able to give me the code for that? I’m really stuck.
Python — File Handling
Loop question, I've tried everything that I knew I just don't know. Please help me solve it out
Help me solve this (using loop)
What is wrong? Error on test.
Help me wiht python