view src/junotu/TagUtility.java @ 86:2a93d2a65b0f

TabCalendarBoard: Saving and loading of calendar board card Also started on column saving.
author Fox
date Mon, 06 Feb 2023 23:58:57 +0100
parents e8d83f1a6100
children 7a3fd865654a
line wrap: on
line source

package junotu;

import java.lang.Long;

import junotu.Main;
import junotu.Card;

public class TagUtility {

    public static Card[] parseCardList( String value )
    {
	if( value.length() == 0 ) {
	    return new Card[0];
	}
	/* This split on an empty string will actually return an array of length 1. */
	String[] identifierStrings = value.split(" ");
	Card[] cards = new Card[identifierStrings.length];
	for( int i = 0; i < identifierStrings.length; i++ ) {
	    long identifier;
	    try {
		identifier = Long.parseLong(identifierStrings[i]);
	    } catch( NumberFormatException e ) {
		cards[i] = null;
		continue;
	    }
	    cards[i] = Main.database.cardGetByIdentifier(identifier);
	}
	return cards;
    }
    
}